示例#1
0
        public static bool RunTest()
        {
            GenericFooCallback <bool> callback = Poo <bool>;

            callback += new GenericFooCallback <bool>(Poo <bool>);

            var obj  = new GenericClass <int>();
            var obj2 = new GenericClass <object>();
            var obj3 = new GenericClass2 <double>();
            var obj4 = (GenericClass <double>)obj3;
            var obj5 = new GenericClass <long> .B <object>();

            callback += obj.TestVirt <bool>;
            obj.i     = 1;
            obj.p     = 2;
            obj2.i    = obj;
            obj2.p    = obj;
            obj5.i    = 77;
            obj5.i2   = null;
            return(!callback(true) &&
                   Poo <int>(true) == 0 && Poo <object>(true) == null &&
                   obj.Foo(1) == 1 && obj2.Foo(obj) == obj &&
                   obj.Foo2 <object>(obj, new GenericClass <object>()) == 2 && obj2.Foo2(obj2, new GenericClass <object>()) == obj &&
                   obj.Boo <object>(5, obj2) == obj2 &&
                   obj4.MyVirt <object>(obj3) && obj4.MyVirt(string.Empty) &&
                   obj3.MyVirt2 <object>(obj3) &&
                   obj5.Aaa <object>(null));
        }
 public static void TwoGenericParameters_GenericBaseClass <T, U>(GenericClass2 <T, U> x)
 {
 }
 public static void EmbeddedGeneric2_TwoGenericParameters_DifferentTypeTest2 <T, U>(GenericClass2 <T, int> t1, GenericClass2 <U, long> t2)
 {
 }
 public static void EmbeddedGeneric2_TwoGenericParameters_DifferentTypeTest4 <T, U>(GenericClass2 <string, T> t1, GenericClass2 <ulong, U> t2)
 {
 }
 public static void EmbeddedGeneric2_OneGeneric_Unused <T>(GenericClass2 <string, int> t)
 {
 }
 public static void EmbeddedGeneric2_NotGeneric(GenericClass2 <string, int> t)
 {
 }
 public static void EmbeddedGenericGeneric2_OneGenericParameter_Second <T>(GenericClass2 <string, T> t)
 {
 }
 public static void EmbeddedGenericGeneric2_OneGenericParameter_First <T>(GenericClass2 <T, int> t)
 {
 }
 public static void EmbeddedGeneric2_TwoGenericParameters_SameType <T, U>(GenericClass2 <T, U> t)
 {
 }
示例#10
0
        public void GenericPropertiesRequireTypeParameters2()
        {
            var o = new GenericClass2 <string>().M();

            AssertEquals(o.GetType().GetProperty("GenericValue2").PropertyType, typeof(GenericClass <string>));
        }
示例#11
0
        static void TestClassParameters()
        {
            var type = Type.GetType("Mono.Linker.Tests.Cases.Reflection.ParametersUsedViaReflection/GenericClass1`1");

            var type2 = new GenericClass2 <int> ();
        }