示例#1
0
        public static void UnitTest_ArrayReferenceTest()
        {
            Dictionary <int, TestGenrRef> dic = new Dictionary <int, TestGenrRef>();

            dic[123] = new TestGenrRef();
            TestGenrRef[] arr = new TestGenrRef[10];
            if (dic.TryGetValue(123, out arr[1]))
            {
                arr[1].DoTestRef();
            }
            else
            {
                throw new Exception();
            }
        }
示例#2
0
        public static void UnitTest_GenericsRefOut()
        {
            ttt   = new TestGenrRef();
            ttt.v = 2;
            TestGenrRef t2 = ReadData <TestGenrRef>(ref ttt);

            Console.WriteLine("new val:" + t2.v);
            Console.WriteLine("new val:" + ttt.v);

            t2.DoTestRef();
            Console.WriteLine("new val:" + t2.v);
            Console.WriteLine("new val:" + ttt.v);

            t2.DoTestRef2();
            t2.DoTestRef3();
        }
示例#3
0
        public static void UnitTest_GenericsRefOut2()
        {
            TestGenrRef t = ReadData2 <TestGenrRef>(null);

            Console.WriteLine("new val:" + t.v);
        }