// Example application for code from // http://www.pobox.com/~skeet/csharp/parameters.html // // To compile the code, run (from a command prompt // with the appropriate environment variables set): // csc Example9.cs // // To run the code after compilation, just run Example9.exe using System; using System.Text; public class Example9 { // Note that ShowNumbers is declared static here just // to make the sample app simple, so we don't // need to instantiate the example class. This // has no bearing on the parameter passing // discussed static void ShowNumbers (params int[] numbers) { foreach (int x in numbers) { Console.Write (x+" "); } Console.WriteLine(); } public static void Main (string[] args) { int[] x = {1, 2, 3}; ShowNumbers (x); ShowNumbers (4, 5); } }