CSharp examples for System:Array Element Add
add Element to Array
using System.Text; using System.Linq; using System.Collections.Generic; using System;/*ww w . j a v a2 s.co m*/ public class Main{ public static bool[] add(bool e, bool[] elements) { int size = elements.Length; System.Array.Copy( elements, elements, size + 1); elements[size] = e; return elements; } public static int[] add(int e, int[] elements) { int size = elements.Length; System.Array.Copy( elements, elements, size + 1); elements[size] = e; return elements; } public static float[] add(float e, float[] elements) { int size = elements.Length; System.Array.Copy( elements, elements, size + 1); elements[size] = e; return elements; } public static T[] add<T>(T e, T[] elements) { int size = elements.Length; System.Array.Copy( elements, elements, size + 1); elements[size] = e; return elements; } public static Attribute<T>[] copy<T>(Attribute<T>[] inT, Attribute<T>[] outT) { for (int i = 0; i < outT.Length; i++) { if (outT[i] == null) { outT[i] = (Attribute<T>)inT[i].Clone(); } else { outT[i].Set( (T)inT[i] ); } } return outT; } }