// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.Collections.Generic; public class Params12 { public static void Test1(params int[] v) { foreach(int v1 in v) Console.Write(" {0}", v1); Console.WriteLine(); } public static void Test2(params List v) { foreach(int v1 in v) Console.Write(" {0}", v1); Console.WriteLine(); } public static void Main(string[] args) { Test1(1); Test1(1, 2); Test1(1, 2, 3); Test2(1); Test2(1, 2); Test2(1, 2, 3); } }