1 // Compiler options: -langversion:default
2 // Test for covariance support in delegates
10 public A (string name
)
12 this.name
= "A::" + name
;
27 public B (string name
)
29 this.name
= "B::" + name
;
38 public C (string name
)
40 this.name
= "C::" + name
;
46 delegate A
MethodHandler (string name
);
48 static A
MethodSampleA (string name
)
53 static B
MethodSampleB (string name
)
58 static C
MethodSampleC (string name
)
65 MethodHandler a
= MethodSampleA
;
66 MethodHandler b
= MethodSampleB
;
67 MethodHandler c
= MethodSampleC
;
69 A instance1
= a ("Hello");
70 A instance2
= b ("World");
71 A instance3
= c ("!");
73 Console
.WriteLine (instance1
.Name
);
74 Console
.WriteLine (instance2
.Name
);
75 Console
.WriteLine (instance3
.Name
);