jamescourtney / FlatSharp

Fast, idiomatic C# implementation of Flatbuffers
Apache License 2.0
511 stars 51 forks source link

Proper Enum Support #11

Closed jamescourtney closed 4 years ago

jamescourtney commented 6 years ago

Investigate what it would take to add proper enum support safely. The biggest risk is that it's easy for a developer to change

public enum MyEnum

to

public enum MyEnum : long

which causes a binary break in the FlatBuffer protocol, which wouldn't be at all obvious to the engineer. One way to do this would be to annotate the enum properties with a "RawDataType" attribute that we could check against the backing type of the enum, and scream if they don't match.