示例#1
0
        public void DoSomething()
        {
            var foo = new Foo {A = 3};
                var bar = new Bar {B = 3};
                Console.WriteLine("Start Values:\nFoo.A: {0} \nBar.B: {1}", foo.A, bar.B);
                TakeFoo(ref foo);
                TakeBar(bar);
                Console.WriteLine("After TakeFoo und TakeBar:\nFoo.A: {0} \nBar.B: {1}", foo.A, bar.B);

                int i = 3;
                Console.WriteLine("Start Value:\nint i {0}", i);
                TakeInt(ref i);
                Console.WriteLine("After TakeInt : int i: {0} \n", i);

                string s  = "vorher";
                Console.WriteLine("Start Value:\nstring s {0}", s);
                TakeString(ref s);
                Console.WriteLine("After TakeString : string s: {0} \n", s);

                int[] array ={0,0,0};
                //array[0] = 0;
               // array[1] = 1;
                //array[2] = 2;
                foreach (var i1 in array)
                {
                    Console.WriteLine("Start Value {0}", array[i1]);
                }
                TakeArray(array);
                foreach (var i2 in array)
                {
                    Console.WriteLine("End Value {0}", i2);
                }
        }
示例#2
0
 private void TakeBar(Bar b)
 {
     b.B = 12;
 }