C# params keyword
public class MyClass { public static void UseParams(params int[] list) { for ( int i = 0 ; i < list.Length ; i++ ) { Console.Write(string.format("{0},",list[i])); } } public static void Main() { UseParams(1); //1, UseParams(1,2,3); //1,2,3, } }
Comments
Post a Comment