Esempio n. 1
0
        public static void TestArrayIndexOfNullableStructOfCanon_Canon()
        {
            // Force canonical implementation Array.IndexOf<GenStructImplementsIEquatable2<__Canon>?>() to be generated and used
            GenStructImplementsIEquatable2 <object>?[] arr = new GenStructImplementsIEquatable2 <object>?[10];
            IndexOfValBase indexOfValCanonForcer           = new IndexOfVal <GenStructImplementsIEquatable2 <object> >();

            indexOfValCanonForcer.FillArray(arr, default(GenStructImplementsIEquatable2 <object>));
            Console.WriteLine(indexOfValCanonForcer.IndexOf(arr, default(GenStructImplementsIEquatable2 <object>)));

            // Just as in the above USG logic
            var typeofGenStructOfString           = typeof(GenStructImplementsIEquatable2 <>).MakeGenericType(TypeOf.String);
            var typeofIndexOfValGenStructOfString = typeof(IndexOfVal <>).MakeGenericType(typeofGenStructOfString);

#if INTERNAL_CONTRACTS
            Assert.IsTrue(RuntimeAugments.IsDynamicType(typeofGenStructOfString.TypeHandle));
#endif
            var typeofNullableGenStructOfString = typeof(Nullable <>).MakeGenericType(typeofGenStructOfString);

            Array          array_GS_String   = Array.CreateInstance(typeofNullableGenStructOfString, 1);
            IndexOfValBase indexOf_GS_String = (IndexOfValBase)Activator.CreateInstance(typeofIndexOfValGenStructOfString);
            indexOf_GS_String.FillArray(array_GS_String, Activator.CreateInstance(typeofGenStructOfString));
            Assert.AreEqual(0, indexOf_GS_String.IndexOf(array_GS_String, Activator.CreateInstance(typeofGenStructOfString)));
        }
Esempio n. 2
0
 public bool Equals(GenStructImplementsIEquatable2 <T> other)
 {
     return(true);
 }