using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using CatLib.Util; namespace TinaX { public static class ArrayUtil { /// /// combine two array. | 拼合两个数组 /// /// type /// /// /// public static T[] Combine(T[] arr1,T[] arr2) //代码参考CatLib: https://github.com/CatLib/Core/blob/2.0/src/CatLib.Core/Util/Arr.cs { arr1 = arr1 ?? Array.Empty(); if (arr2 == null || arr2.Length <= 0) return arr1; Array.Resize(ref arr1, arr1.Length + arr2.Length); Array.Copy(arr2, 0, arr1, arr1.Length - arr2.Length, arr2.Length); return arr1; } /// /// combine two array. | 拼合两个数组 /// /// type /// /// /// public static void Combine(ref T[] arr1, T[] arr2) //代码参考CatLib: https://github.com/CatLib/Core/blob/2.0/src/CatLib.Core/Util/Arr.cs { arr1 = arr1 ?? Array.Empty(); if (arr2 == null || arr2.Length <= 0) return; Array.Resize(ref arr1, arr1.Length + arr2.Length); Array.Copy(arr2, 0, arr1, arr1.Length - arr2.Length, arr2.Length); } public static void RemoveDuplicationElements(ref T[] arr) { arr = arr.Distinct().ToArray(); } } }