[sdks] Fix README.md
[mono-project.git] / mcs / tests / test-504.cs
blobd99207e30c182c16e4cddf177e5f167281d28bd7
1 // This ensures that any "unreachable code" warning will error out
2 // rather than generate invalid IL or crash compiler
4 using System;
6 public enum FooEnum
8 One,
9 Two
12 class Foo
14 public static int y = 1;
15 public static int f () { return 0; }
16 public static int Main ()
18 int x;
20 do {
21 x = f ();
22 if (x != 0)
23 continue;
24 return 0;
25 } while (x > y);
27 return 1;
30 public static string Test_2 ()
32 throw new Exception ();
34 var account = "yo";
35 if (account == null) {
38 var s = "yo";
40 switch (8) {
41 case 1:
42 case 2:
43 break;
44 default:
45 throw new NotSupportedException ();
48 return s;
51 const FooEnum foo = FooEnum.Two;
53 static void Test_3 ()
55 object obj;
57 switch (foo) {
58 case FooEnum.One:
59 obj = new object ();
60 break;
61 case FooEnum.Two:
62 obj = new object ();
63 break;
66 Console.WriteLine (obj);