Example #1
0
        public void TestCallByRef()
        {
            TestA t = new TestA();

            callByRef(ref t);
            Assert.IsTrue(5 == t.a);

            t.SetB(6);
            Assert.IsTrue(6 == t.b);

            TestA u = callWithReturnValue();

            Assert.IsTrue(7 == u.a);

            callByValue(t);
        }
Example #2
0
        void callByValue(TestA a)
        {
            a.a = 6;

            Console.WriteLine(a.a);
        }
Example #3
0
 void callByRef(ref TestA a)
 {
     a.a = 5;
     a.SetB(2);
 }