blob: 87f7dbbfe01a5ef85e4217a60fefe28531bdea5c (
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
38
39
40
41
42
43
44
45
46
47
|
class X {
static object get_non_null ()
{
return new X ();
}
static object get_null ()
{
return null;
}
static int Main ()
{
int a = 5;
object o;
decimal d = 0M;
//
// compile time
//
if (!(get_non_null () is object))
return 1;
if (get_null () is object)
return 2;
if (!(a is object))
return 3;
//
// explicit reference
//
if (null is object)
return 4;
o = a;
if (!(o is int))
return 5;
if (d is int)
return 6;
System.Console.WriteLine ("Is tests pass");
return 0;
}
}
|