title: protobuf-net: inheritance in C# but not in wire-format
body: <p>I get that protobuf do not support inheritance, and since I am using protoc-c on another end, I do not want to use any extensions as well. However, I am stuck with a C# model that depends on inheritance:</p>
  
  <pre><code>class Header {
       public int version { get; set; }
  }
  
  class Message : Header {
       public String message { get; set; }
  }
  </code></pre>
  
  <p>I attempted to switch the inheritance into encapsulation in the wire format to something like this:</p>
  
  <pre><code>[ProtoContract]
  class Header {
       [ProtoMember(1)]
       public int version { get; set; }
  }
  
  [ProtoContract]
  class Message : Header {
       [ProtoMember(1)]
       public Header Header { get { return this; } set { } }
  
       [ProtoMember(2)]
       public String Message { get; set; }
  }
  </code></pre>
  
  <p>Then I get the "Unexpected sub-type" error which prompts me to:
  <a href="https://stackoverflow.com/questions/3100207/why-i-have-to-use-protoinclude">Why I have to use [ProtoInclude]?</a></p>
  
  <p>I feel that my case is different than the case in the above question, so would like to ask again for my specific case, where I have tried to inside out the inheritance, is this impossible to do without having ProtoInclude?</p>
  
  <p>If not, how would I do it in v2? </p>
  
  <p>----- EDITED ------</p>
  
  <p>My proto file in the C (using protobuf-c) side is something like this:</p>
  
  <pre><code>message Header {
      optional int32 version = 1;
  }
  
  message Message {
      optional Header header = 1;
      optional string message = 2;
  }
  </code></pre>
  
  <p>I do not want to put the Message inside the Header, and I do not want the inheritance-over-the-wire feature. This format enables me to add stuffs into the Header message easily without needing to change the Message message.</p>