static void Test1() { Console.WriteLine("--- Test1"); D1 d = new D1(); Console.WriteLine(d.Foo <string>()); Console.WriteLine(d.Fct("ok")); }
public static int Main(string[] args) { //Comments are what is printed out. var d1 = new D1(); var d2 = new D2(); d1.Foo <C1>(); //31 Console.WriteLine(); d1.Foo <C2>(); //31 Console.WriteLine(); //d2.Foo<C1>(); //Error constraint mismatch d2.Foo <C2>(); //421 Console.WriteLine(); B_base b_d2 = d2; b_d2.Foo <C1>(); //1 Console.WriteLine(); b_d2.Foo <C2>(); //1 Console.WriteLine(); return(0); }