[Issue 252] Add type cast for default enum values in C#
When creating a CreateXxx(...) method for a simple table type, enum-type fields with a non-zero default must have an explicit cast for the respective argument default value, because in C#, there is an implicit cast from int to an enum only for 0. Also, added an example of such type into the example monster_test type, so that we test this feature.
Showing
- src/idl_gen_general.cpp 9 additions, 1 deletionsrc/idl_gen_general.cpp
- tests/FlatBuffers.Test/FlatBuffers.Test.csproj 3 additions, 0 deletionstests/FlatBuffers.Test/FlatBuffers.Test.csproj
- tests/MyGame/Example/Any.cs 1 addition, 0 deletionstests/MyGame/Example/Any.cs
- tests/MyGame/Example/Any.go 1 addition, 0 deletionstests/MyGame/Example/Any.go
- tests/MyGame/Example/Any.java 2 additions, 1 deletiontests/MyGame/Example/Any.java
- tests/MyGame/Example/TestSimpleTableWithEnum.cs 31 additions, 0 deletionstests/MyGame/Example/TestSimpleTableWithEnum.cs
- tests/MyGame/Example/TestSimpleTableWithEnum.go 27 additions, 0 deletionstests/MyGame/Example/TestSimpleTableWithEnum.go
- tests/MyGame/Example/TestSimpleTableWithEnum.java 31 additions, 0 deletionstests/MyGame/Example/TestSimpleTableWithEnum.java
- tests/monster_test.fbs 5 additions, 1 deletiontests/monster_test.fbs
- tests/monster_test_generated.h 34 additions, 2 deletionstests/monster_test_generated.h
Loading
Please register or sign in to comment