Closed Roy-se7en closed 8 months ago
In the protobuf wire format, there is no distinction between "null" and "empty", nor any concept of "null" at all. By default, then, protobuf-net:
This means that by default, your collection will be whatever your type initializes it as. A common approach is to initialize as empty:
[ProtoMember(42)]
public List<Foo> Foos {get;} = new();
For explicit null support, allowing nulls to be represented separately to empty (for both elements and the collection, separately), see: https://protobuf-net.github.io/protobuf-net/nullwrappers
Thanks for your reply!
if the server return the data (include the empty list), the client receive the list is null?