using System.Collections.Generic; using System; class C { class Q { public Type[] apply (C t) { return t.bar(); } } public Type[] foo () { Q q = new Q(); return q.apply(this); } public Type[] bar () { return new Type[] { typeof(X), typeof(Y), typeof(A), typeof(B) }; } } class TypeofTest { public bool Bla() { Type t = typeof (Dictionary<,>); Type t2 = typeof (C<,>); return t.IsGenericTypeDefinition && t2.IsGenericTypeDefinition; } } class TypeofTest2 { public bool Bla() { Type t = typeof (Dictionary<,>); Type t2= typeof (C<,>); return t.IsGenericTypeDefinition && t2.IsGenericTypeDefinition; } } class Driver { public static int Main () { C c = new C(); Type[] types = c.foo (); foreach (Type t in types) Console.WriteLine (t); if (types [0] != typeof (int)) return 1; if (types [1] != typeof (string)) return 2; if (types [2] != typeof (float)) return 3; if (types [3] != typeof (string)) return 4; if (!new TypeofTest().Bla()) return 5; if (!new TypeofTest2().Bla()) return 6; return 0; } }