blob: 08bc431e243928d9faffbbc070e1667af59cc7f6 [file] [log] [blame]
// <auto-generated>
// automatically generated by the FlatBuffers compiler, do not modify
// </auto-generated>
namespace NamespaceA.NamespaceB
{
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public enum UnionInNestedNS : byte
{
NONE = 0,
TableInNestedNS = 1,
};
public class UnionInNestedNSUnion {
public UnionInNestedNS Type { get; set; }
public object Value { get; set; }
public UnionInNestedNSUnion() {
this.Type = UnionInNestedNS.NONE;
this.Value = null;
}
public T As<T>() where T : class { return this.Value as T; }
public NamespaceA.NamespaceB.TableInNestedNST AsTableInNestedNS() { return this.As<NamespaceA.NamespaceB.TableInNestedNST>(); }
public static UnionInNestedNSUnion FromTableInNestedNS(NamespaceA.NamespaceB.TableInNestedNST _tableinnestedns) { return new UnionInNestedNSUnion{ Type = UnionInNestedNS.TableInNestedNS, Value = _tableinnestedns }; }
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, UnionInNestedNSUnion _o) {
switch (_o.Type) {
default: return 0;
case UnionInNestedNS.TableInNestedNS: return NamespaceA.NamespaceB.TableInNestedNS.Pack(builder, _o.AsTableInNestedNS()).Value;
}
}
}
public class UnionInNestedNSUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
public override bool CanConvert(System.Type objectType) {
return objectType == typeof(UnionInNestedNSUnion) || objectType == typeof(System.Collections.Generic.List<UnionInNestedNSUnion>);
}
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = value as System.Collections.Generic.List<UnionInNestedNSUnion>;
if (_olist != null) {
writer.WriteStartArray();
foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
writer.WriteEndArray();
} else {
this.WriteJson(writer, value as UnionInNestedNSUnion, serializer);
}
}
public void WriteJson(Newtonsoft.Json.JsonWriter writer, UnionInNestedNSUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
if (_o == null) return;
serializer.Serialize(writer, _o.Value);
}
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = existingValue as System.Collections.Generic.List<UnionInNestedNSUnion>;
if (_olist != null) {
for (var _j = 0; _j < _olist.Count; ++_j) {
reader.Read();
_olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
}
reader.Read();
return _olist;
} else {
return this.ReadJson(reader, existingValue as UnionInNestedNSUnion, serializer);
}
}
public UnionInNestedNSUnion ReadJson(Newtonsoft.Json.JsonReader reader, UnionInNestedNSUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
if (_o == null) return null;
switch (_o.Type) {
default: break;
case UnionInNestedNS.TableInNestedNS: _o.Value = serializer.Deserialize<NamespaceA.NamespaceB.TableInNestedNST>(reader); break;
}
return _o;
}
}
}