mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-23 18:31:48 +00:00
Add enum name lookup method to Java/C# enums
Tested: on Linux for Java and C# Bug: 15781151 Change-Id: I7cb97bcc01d986cac2b24aaf7cb29521ddaa2f6b
This commit is contained in:
@@ -5,9 +5,13 @@ namespace MyGame.Example
|
||||
|
||||
public class Color
|
||||
{
|
||||
public static sbyte Red = 1;
|
||||
public static sbyte Green = 2;
|
||||
public static sbyte Blue = 8;
|
||||
public static readonly sbyte Red = 1;
|
||||
public static readonly sbyte Green = 2;
|
||||
public static readonly sbyte Blue = 8;
|
||||
|
||||
private static readonly string[] names = { "Red", "Green", "", "", "", "", "", "Blue", };
|
||||
|
||||
public static string Name(int e) { return names[e - Red]; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user