blob: 90a82add53a3a2d513d274d1c70a8129f3af3739 (
plain)
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
|
using System;
class Gen<T> where T : class
{
public static bool Foo (T t)
{
return t is Program;
}
}
class Program
{
static bool Foo<T> ()
{
object o = 1;
return o is T;
}
public static int Main ()
{
if (Foo<bool> ())
return 1;
if (!Foo<int> ())
return 2;
if (Gen<object>.Foo (null))
return 3;
if (!Gen<Program>.Foo (new Program ()))
return 4;
Console.WriteLine ("ok");
return 0;
}
}
|