// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace E { public class Program { public static void Main(string[] args) { int[] ia = { 1, 2, 3 }; foreach(int iv in ia) { Console.WriteLine(iv); } // old way: int[] ia2 = new int[4]; ia.CopyTo(ia2, 0); ia2[3] = 4; foreach(int iv in ia2) { Console.WriteLine(iv); } // .NET 3.5 way Array.Resize(ref ia, 4); ia[3] = 4; foreach(int iv in ia2) { Console.WriteLine(iv); } } } }