Advertisement
Dracorat

Array Combination Methods

Apr 11th, 2013
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1.     public static void AppendSecondArrayToFirst<T>(ref T[] first, T[] second){
  2.         int arrayOriginalSize = first.Length;
  3.         Array.Resize<T>(ref first, first.Length + second.Length);
  4.         Array.Copy(second, 0, first, arrayOriginalSize, second.Length);
  5.     }
  6.    
  7.     public static T[] CreateCombinedArrayFrom<T>(T[] first, T[] second)
  8.     {
  9.         T[] result = new T[first.Length + second.Length];
  10.         Array.Copy(first, 0, result, 0, first.Length);
  11.         Array.Copy(second, 0, result, first.Length, second.Length);
  12.         return result;
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement