[netcore] Implement/fix enum/nullable comparers.
[mono-project.git] / mono / tests / reflection-const-field.cs
blobc2f838c88b64ad671a48895d36add8ec179faac7
1 using System;
2 using System.Reflection;
4 class T {
6 public const bool a = true;
7 public const byte b = 1;
8 public const sbyte c = 2;
9 public const sbyte cc = -3;
10 public const sbyte ccc = 0;
11 public const char d = 'a';
12 public const short e = 4;
13 public const short ee = -5;
14 public const short eee = 0;
15 public const ushort f = 6;
16 public const int g = 7;
17 public const int gg = -8;
18 public const int ggg = 0;
19 public const uint h = 9;
20 public const long i = 10;
21 public const long ii = -11;
22 public const long iii = 0;
23 public const ulong j = 12;
24 public const double k = 13.0;
25 public const double kk = -14.0;
26 public const double kkk = 0;
27 public const float l = 15;
28 public const float ll = -16;
29 public const float lll = 0;
30 public const string m = "la la la";
31 public const string n = null;
33 static void Main ()
35 X ("a", a);
36 X ("b", b);
37 X ("c", c);
38 X ("cc", cc);
39 X ("ccc", ccc);
40 X ("d", d);
41 X ("e", e);
42 X ("ee", ee);
43 X ("eee", eee);
44 X ("f", f);
45 X ("g", g);
46 X ("gg", gg);
47 X ("ggg", ggg);
48 X ("h", h);
49 X ("i", i);
50 X ("ii", ii);
51 X ("iii", iii);
52 X ("j", j);
53 X ("k", k);
54 X ("kk", kk);
55 X ("kkk", kkk);
56 X ("l", l);
57 X ("ll", ll);
58 X ("lll", lll);
59 X ("m", m);
60 X ("n", n);
63 static void X (string n, object o)
65 if (! Object.Equals (typeof (T).GetField (n).GetValue (null), o))
66 throw new Exception (n);