mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-05 21:17:25 +00:00
* [C#] support Object API * fix sign-compare * fix indent * add new line before for loop. * using auto whenever possible * reduce the amout of blank lines. * wip: support vectors of union * done: support unions of vectors * set C# version to 4.0 * remove null propagation operator * remove auto property initializer * remove expression-bodied method * remove pattern matching * add Example2 to NetTest.sh * separate JavaUsage.md and CsharpUsage.md from JavaCsharpUsage.md * add C# Object based API notes. * support vs2010. * remove range based for loop. * remove System.Linq * fix indent * CreateSharedString to CreateString * check shared attribute * snake case
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
// <auto-generated>
|
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
// </auto-generated>
|
|
|
|
namespace MyGame.Example
|
|
{
|
|
|
|
public enum AnyUniqueAliases : byte
|
|
{
|
|
NONE = 0,
|
|
M = 1,
|
|
TS = 2,
|
|
M2 = 3,
|
|
};
|
|
|
|
public class AnyUniqueAliasesUnion {
|
|
public AnyUniqueAliases Type { get; set; }
|
|
public object Value { get; set; }
|
|
|
|
public AnyUniqueAliasesUnion() {
|
|
this.Type = AnyUniqueAliases.NONE;
|
|
this.Value = null;
|
|
}
|
|
|
|
public T As<T>() where T : class { return this.Value as T; }
|
|
public MyGame.Example.MonsterT AsM() { return this.As<MyGame.Example.MonsterT>(); }
|
|
internal MyGame.Example.TestSimpleTableWithEnumT AsTS() { return this.As<MyGame.Example.TestSimpleTableWithEnumT>(); }
|
|
public MyGame.Example2.MonsterT AsM2() { return this.As<MyGame.Example2.MonsterT>(); }
|
|
|
|
public static int Pack(FlatBuffers.FlatBufferBuilder builder, AnyUniqueAliasesUnion _o) {
|
|
switch (_o.Type) {
|
|
default: return 0;
|
|
case AnyUniqueAliases.M: return MyGame.Example.Monster.Pack(builder, _o.AsM()).Value;
|
|
case AnyUniqueAliases.TS: return MyGame.Example.TestSimpleTableWithEnum.Pack(builder, _o.AsTS()).Value;
|
|
case AnyUniqueAliases.M2: return MyGame.Example2.Monster.Pack(builder, _o.AsM2()).Value;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|