Enums use native enums in C#

Enums should not be (badly) emulated with classes in C# but should
use native C# enums instead. Java implementation made an explicit
choice not to use the (more complex) Java enums, but C# enums are
just light-weight syntactic coating over integral types.

Fixes issue #171.

Change-Id: I9f4d6ba5324400a1e52982e49b58603cb7d7cca7
This commit is contained in:
Mormegil
2015-04-13 13:25:03 +02:00
committed by Wouter van Oortmerssen
parent 557c57eb9d
commit e3b432cba8
6 changed files with 129 additions and 91 deletions

View File

@@ -3,15 +3,10 @@
namespace MyGame.Example
{
public sealed class Any
public enum Any : byte
{
private Any() { }
public static readonly byte NONE = 0;
public static readonly byte Monster = 1;
private static readonly string[] names = { "NONE", "Monster", };
public static string Name(int e) { return names[e]; }
NONE = 0,
Monster = 1,
};