Search code examples
c#protobuf-net

protobuf-net: properties versus fields


In our project, we have a data transfer object (DTO) class which is decorated with a [ProtoContract] attribute, and all of its members are public properties decorated with [ProtoMember] attributes - except that one of the members is a public field (by accident). Now we want to change the one public field into a property. Can this have an impact about the implicit protobuf contract? (We want to avoid breaking changes, and I suppose that this change is non-breaking, but I want to be sure.)


Solution

  • Yes, that's absolutely fine; protobuf-net won't care, and the serialized payload will remain identical.