I am working a project where we need to determine if a protobuf list
have is null or not in the protocol buffer.

The problem is the generated c# automatically instantiates the list.

IE. Protocol:
message B {
  repeated A MyList = 0;

Generated C#:

private readonly global::System.Collections.Generic.List<A> _MyList =
new global::System.Collections.Generic.List<A>();
    [global::ProtoBuf.ProtoMember(0, Name=@"MyList", DataFormat =
    public global::System.Collections.Generic.List<A> MyList
      get { return _MyList ; }

The problem with this is I cannot determine if the list is null. I am
using an empty list as a way to remove all objects.

Is there a way where I can make the generator not automatically
instantiate the list? Better yet, how do I check for default values in
protocol buffer C#? I know you can check for

Thanks for the help!


You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to