// Example application for code from // https://jonskeet.uk/csharp/parameters.html // // To compile the code, run (from a command prompt // with the appropriate environment variables set): // csc Example5.cs // // To run the code after compilation, just run Example5.exe using System; using System.Text; public class Example5 { struct IntHolder { public int i; } // Note that Foo 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 Foo (IntHolder x) { x.i=10; } public static void Main (string[] args) { IntHolder y = new IntHolder(); y.i=5; Foo (y); Console.WriteLine (y.i); } }