mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-06 05:27:24 +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
46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
// <auto-generated>
|
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
// </auto-generated>
|
|
|
|
public enum Character : byte
|
|
{
|
|
NONE = 0,
|
|
MuLan = 1,
|
|
Rapunzel = 2,
|
|
Belle = 3,
|
|
BookFan = 4,
|
|
Other = 5,
|
|
Unused = 6,
|
|
};
|
|
|
|
public class CharacterUnion {
|
|
public Character Type { get; set; }
|
|
public object Value { get; set; }
|
|
|
|
public CharacterUnion() {
|
|
this.Type = Character.NONE;
|
|
this.Value = null;
|
|
}
|
|
|
|
public T As<T>() where T : class { return this.Value as T; }
|
|
public AttackerT AsMuLan() { return this.As<AttackerT>(); }
|
|
public RapunzelT AsRapunzel() { return this.As<RapunzelT>(); }
|
|
public BookReaderT AsBelle() { return this.As<BookReaderT>(); }
|
|
public BookReaderT AsBookFan() { return this.As<BookReaderT>(); }
|
|
public string AsOther() { return this.As<string>(); }
|
|
public string AsUnused() { return this.As<string>(); }
|
|
|
|
public static int Pack(FlatBuffers.FlatBufferBuilder builder, CharacterUnion _o) {
|
|
switch (_o.Type) {
|
|
default: return 0;
|
|
case Character.MuLan: return Attacker.Pack(builder, _o.AsMuLan()).Value;
|
|
case Character.Rapunzel: return Rapunzel.Pack(builder, _o.AsRapunzel()).Value;
|
|
case Character.Belle: return BookReader.Pack(builder, _o.AsBelle()).Value;
|
|
case Character.BookFan: return BookReader.Pack(builder, _o.AsBookFan()).Value;
|
|
case Character.Other: return builder.CreateString(_o.AsOther()).Value;
|
|
case Character.Unused: return builder.CreateString(_o.AsUnused()).Value;
|
|
}
|
|
}
|
|
}
|
|
|