public TestTableWithUnionAndMoreFields ReadTestTableWithUnionAndMoreFields(byte[] buffer) { var test = SerializationTests.TestTableWithUnionAndMoreFields.GetRootAsTestTableWithUnionAndMoreFields( new ByteBuffer(buffer)); var result = new TestTableWithUnionAndMoreFields() { IntProp = test.IntProp, DoubleProp = test.DoubleProp, StringProp = test.StringProp, FloatProp = test.FloatProp }; var unionType = test.UnionPropType; if (unionType == TestUnion.TestTable1) { var obj = new SerializationTests.TestTable1(); var res = test.GetUnionProp(obj); result.UnionProp = new TestTable1() { IntProp = res.IntProp, ByteProp = res.ByteProp, ShortProp = res.ShortProp }; } if (unionType == TestUnion.TestTable2) { var obj = new SerializationTests.TestTable2(); var res = test.GetUnionProp(obj); result.UnionProp = new TestTable2 { StringProp = res.StringProp }; } return(result); }
private static TestTable1 FromTestSchema(SerializationTests.TestTable1 testTable1) { return(new TestTable1() { IntProp = testTable1.IntProp, ByteProp = testTable1.ByteProp, ShortProp = testTable1.ShortProp }); }