Use params to mark parameter
using System;
class ParamsSample {
static void PrintStrings(params String[] StringArray) {
for (int i = 0; i < StringArray.Length; i++)
Console.Write("{0} ", StringArray[i]);
Console.WriteLine();
}
static void Main(String[] args) {
String names = "K";
PrintStrings("A");
PrintStrings(names, "R", "S");
PrintStrings("R", "E", "C", "S");
}
}
Related examples in the same category