2 using System.Reflection;
6 public static int Main ()
8 Type type = typeof (Foo<>);
9 Type [] gargs = type.GetGenericArguments ();
10 if (gargs == null || gargs.Length != 1) {
11 Console.WriteLine ("#1");
15 Type garg = gargs [0];
16 Type [] csts = garg.GetGenericParameterConstraints ();
18 if (garg.Name != "T") {
19 Console.WriteLine ("#2: " + garg.Name);
22 if (garg.GenericParameterAttributes !=
23 (GenericParameterAttributes.DefaultConstructorConstraint | GenericParameterAttributes.NotNullableValueTypeConstraint)) {
24 Console.WriteLine ("#3: " + garg.GenericParameterAttributes);
27 if (csts == null || csts.Length != 1) {
28 Console.WriteLine ("#4");
31 if (csts [0] != typeof (ValueType)) {
32 Console.WriteLine ("#5: " + csts [0].FullName);
40 struct Foo<T> where T : struct