1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
class C<X,Y> { class Q<A,B> { public void apply (C<X,Y> t) { t.bar<A,B>(); } } public void foo<A,B> () { Q<A,B> q = new Q<A,B>(); q.apply(this); } public void bar<A,B> () { System.Console.WriteLine ("'{0} {1} {2} {3}'", typeof(X),typeof(Y),typeof(A),typeof(B)); } } class X { public static void Main () { C<int,string> c = new C<int,string>(); c.foo<float,string> (); } }