blob: d99207e30c182c16e4cddf177e5f167281d28bd7 (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// This ensures that any "unreachable code" warning will error out
// rather than generate invalid IL or crash compiler
using System;
public enum FooEnum
{
One,
Two
};
class Foo
{
public static int y = 1;
public static int f () { return 0; }
public static int Main ()
{
int x;
do {
x = f ();
if (x != 0)
continue;
return 0;
} while (x > y);
return 1;
}
public static string Test_2 ()
{
throw new Exception ();
var account = "yo";
if (account == null) {
}
var s = "yo";
switch (8) {
case 1:
case 2:
break;
default:
throw new NotSupportedException ();
}
return s;
}
const FooEnum foo = FooEnum.Two;
static void Test_3 ()
{
object obj;
switch (foo) {
case FooEnum.One:
obj = new object ();
break;
case FooEnum.Two:
obj = new object ();
break;
}
Console.WriteLine (obj);
}
}
|