Method Parameters Formal Reference C# with Example
using System; namespace CSharpFundamentals { class MyClass { public int Value = 20; } class MethodParametersFormalReference { static void RefAsParameter( MyClass objByVal ) { objByVal.Value = 50; Console.WriteLine( "After member assignment: {0}", objByVal.Value ); objByVal = new MyClass(); Console.WriteLine( "After new object creation: {0}", objByVal.Value ); } static void Main( ) { MyClass obj = new MyClass(); Console.WriteLine( "Before method call: {0}", obj.Value ); RefAsParameter( obj ); Console.WriteLine( "After method call: {0}", obj.Value ); } } }