1 // Test for constraints on generic parameters
3 .assembly extern mscorlib
9 .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = (
10 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78
11 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )
17 .class interface private auto ansi abstract ITest1
21 .class interface private auto ansi abstract ITest
25 .class private auto ansi beforefieldinit bb
26 extends [mscorlib]System.Object
28 .method public hidebysig specialname rtspecialname
29 instance default void .ctor () cil managed
33 IL_0001: call instance void object::.ctor()
39 /* Constraints : .ctor, base class, interfaces */
40 .class private auto ansi beforefieldinit gen`1 <.ctor (class bb, class [mscorlib]System.Collections.Generic.ICollection`1<!T>, class [mscorlib]System.Collections.ICollection, class ITest1) T>
41 extends [mscorlib]System.Object
43 .method public hidebysig specialname rtspecialname
44 instance default void .ctor () cil managed
48 IL_0001: call instance void object::.ctor()
52 /* Constraints on a method's generic params */
53 .method public hidebysig
54 instance default void foo<.ctor (class [mscorlib]System.Collections.Generic.ICollection`1<!!0>) M> () cil managed
62 /* Constraint : class */
63 .class private auto ansi beforefieldinit foo`1<class M>
64 extends [mscorlib]System.Object
66 .method public hidebysig specialname rtspecialname
67 instance default void .ctor () cil managed
71 IL_0001: call instance void object::.ctor()
77 /* Constraint : valuetype */
78 .class private auto ansi beforefieldinit bar`1<valuetype M>
79 extends [mscorlib]System.Object
81 .method public hidebysig specialname rtspecialname
82 instance default void .ctor () cil managed
86 IL_0001: call instance void object::.ctor()
92 /* Constraint : generic constraint */
93 .class private auto ansi beforefieldinit abc`1 <(class foo`1<class bb>) M>
94 extends [mscorlib]System.Object
96 .method public hidebysig specialname rtspecialname
97 instance default void .ctor () cil managed
101 IL_0001: call instance void object::.ctor()