예제 #1
0
        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);
            }
        }
예제 #2
0
 private void PassValue(int a, SampleEnum se, DateTime dt, SampleStruct sst)
 {
     a = 50;                 //a local variable copied from aSource
     sst.IntrnalValue = 100; //won't touch sSource.InternalValue
     //Check the DateTime is immutable
 }