public void MainMethod() { { int aSource = 10; DateTime dtSource = DateTime.UtcNow; SampleStruct sSource = new SampleStruct(); sSource.IntrnalValue = 9; SampleStruct sSourceV2 = new SampleStruct { IntrnalValue = 9 }; PassValue(aSource, SampleEnum.Done, dtSource, sSource); Console.WriteLine(sSource.IntrnalValue); // => 9 } { var scSource = new SampleClass(); PassReference(scSource); } { int aSource = 10; PassValueAsReference(ref aSource); } { int aSource; AwaitValue(out aSource); } }
private void PassReference(SampleClass sc) { sc = new SampleClass(); //sc local copy of reference, scSource still same as before }