Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gtest-219.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9bf413a16f390a5c5fafb1b7b5305dac468839f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using System.Reflection;

public interface IFoo : ICloneable {}

public class Test
{
        public void Foo<T> () where T : IFoo {}

        public static int Main ()
        {
		MethodInfo mi = typeof (Test).GetMethod ("Foo");
		Type t = mi.GetGenericArguments () [0];
		Type[] ifaces = t.GetGenericParameterConstraints ();
		if (ifaces.Length != 1)
			return 1;
		if (ifaces [0] != typeof (IFoo))
			return 2;
		return 0;
        }
}