Skip to content

Instantly share code, notes, and snippets.

@mgravell
Last active September 3, 2018 11:24
Show Gist options
  • Save mgravell/a33755800e823ee77ba01183be7084df to your computer and use it in GitHub Desktop.
Save mgravell/a33755800e823ee77ba01183be7084df to your computer and use it in GitHub Desktop.
[ProtoContract(Name = "MSG1")]
[ProtoInclude(3, typeof(Message2))]
class Message1
{
[ProtoMember(1, Name = "account", IsRequired = true)]
public string Account { get; set; }
[ProtoMember(2, Name = "symbol", IsRequired = true)]
public string Symbol { get; set; }
}
[ProtoContract(Name = "MSG2")]
class Message2 : Message1
{
[ProtoMember(2, Name = "id", IsRequired = true)]
public int Id { get; set; }
}
syntax = "proto2";
message MSG1 {
required string account = 1;
required string symbol = 2;
oneof subtype {
MSG2 MSG2 = 3;
}
}
message MSG2 {
required int32 id = 2;
}
syntax = "proto3";
message MSG1 {
string account = 1;
string symbol = 2;
oneof subtype {
MSG2 MSG2 = 3;
}
}
message MSG2 {
int32 id = 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment