// file: Out_Parameters.cs.txt // c# Console Application "OutParameters.cs" using System; namespace csOutParameters { class OutParameters { static void Main(string[] args) { int x = 1; Console.WriteLine("Using: AnyMethodNoRef(int myParameter).........."); Console.WriteLine("Before... x=" + x.ToString() ); AnyMethodNoRef(x); Console.WriteLine("After.... x=" + x.ToString() ); Console.WriteLine(""); Console.WriteLine("---------------------------------------------------"); Console.WriteLine("Using: AnyMethodWithRef(ref int myParameter)...."); Console.WriteLine("Before... x=" + x.ToString() ); AnyMethodWithRef(ref x); Console.WriteLine("After.... x=" + x.ToString() ); Console.ReadLine(); } static void AnyMethodNoRef(int myParameter) { myParameter++; } public static void AnyMethodWithRef(ref int myParameter) { myParameter++; } } }