mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 10:21:48 +00:00
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:
committed by
Wouter van Oortmerssen
parent
557c57eb9d
commit
e3b432cba8
@@ -12,11 +12,11 @@ public sealed class Vec3 : Struct {
|
||||
public float Y() { return bb.GetFloat(bb_pos + 4); }
|
||||
public float Z() { return bb.GetFloat(bb_pos + 8); }
|
||||
public double Test1() { return bb.GetDouble(bb_pos + 16); }
|
||||
public sbyte Test2() { return bb.GetSbyte(bb_pos + 24); }
|
||||
public Color Test2() { return (Color)bb.GetSbyte(bb_pos + 24); }
|
||||
public Test Test3() { return Test3(new Test()); }
|
||||
public Test Test3(Test obj) { return obj.__init(bb_pos + 26, bb); }
|
||||
|
||||
public static int CreateVec3(FlatBufferBuilder builder, float X, float Y, float Z, double Test1, sbyte Test2, short Test_A, sbyte Test_B) {
|
||||
public static int CreateVec3(FlatBufferBuilder builder, float X, float Y, float Z, double Test1, Color Test2, short Test_A, sbyte Test_B) {
|
||||
builder.Prep(16, 32);
|
||||
builder.Pad(2);
|
||||
builder.Prep(2, 4);
|
||||
@@ -24,7 +24,7 @@ public sealed class Vec3 : Struct {
|
||||
builder.PutSbyte(Test_B);
|
||||
builder.PutShort(Test_A);
|
||||
builder.Pad(1);
|
||||
builder.PutSbyte(Test2);
|
||||
builder.PutSbyte((sbyte)(Test2));
|
||||
builder.PutDouble(Test1);
|
||||
builder.Pad(4);
|
||||
builder.PutFloat(Z);
|
||||
|
||||
Reference in New Issue
Block a user