Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ee0bc0d176
Fetching contributors…

Cannot retrieve contributors at this time

file 65 lines (56 sloc) 1.19 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
using System.Collections.Generic;
using System;

class C<X,Y>
{
class Q<A,B>
{
public Type[] apply (C<X,Y> t)
{
return t.bar<A,B>();
}
}

public Type[] foo<A,B> ()
{
Q<A,B> q = new Q<A,B>();
return q.apply(this);
}

public Type[] bar<A,B> ()
{
return new Type[] { typeof(X), typeof(Y), typeof(A), typeof(B) };
}
}


class TypeofTest {
public bool Bla() {
Type t = typeof (Dictionary<,>);
Type t2 = typeof (C<,>);
return t.IsGenericTypeDefinition && t2.IsGenericTypeDefinition;
}
}

class TypeofTest2<X,Y> {
public bool Bla() {
Type t = typeof (Dictionary<,>);
Type t2= typeof (C<,>);
return t.IsGenericTypeDefinition && t2.IsGenericTypeDefinition;
}
}

class Driver {
public static int Main () {
C<int,string> c = new C<int,string>();
Type[] types = c.foo<float,string> ();
foreach (Type t in types)
Console.WriteLine (t);
if (types [0] != typeof (int))
return 1;
if (types [1] != typeof (string))
return 2;
if (types [2] != typeof (float))
return 3;
if (types [3] != typeof (string))
return 4;

if (!new TypeofTest().Bla())
return 5;
if (!new TypeofTest2<int, double>().Bla())
return 6;

return 0;
}
}
Something went wrong with that request. Please try again.