// 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 Example6.cs // // To run the code after compilation, just run Example6.exe using System; using System.Text; public class Example6 { // 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 (ref StringBuilder x) { x = null; } public static void Main (string[] args) { StringBuilder y = new StringBuilder(); y.Append ("hello"); Foo (ref y); Console.WriteLine (y==null); } }