CSharp examples for System:Array Element Add
Append item to Array
public class Main{ public static T[] ArrayAdd<T>(this T[] obj, T item) {//from w w w. ja va2s .c om if (obj == null) { return new T[1] { item }; } T[] newArray = new T[obj.Length + 1]; for (int i = 0; i < obj.Length; i++) { newArray[i] = obj[i]; } newArray[newArray.Length - 1] = item; return newArray; } }