I want to tag each protobuf serialized data with my own version number. so i can check which version was used to serialize data if required. Although protobuf is designed around idea so you don't need to check version.
To do that i can use same way we have been doing in .net serialization add version field in it.
Just want to confirm that this is the preferred way of doing in protobuf as well.
class protodata1
{
public protodata1()
{
version = 1;
}
[Protomember(1)]
int version { get; set;}
[Protomember(2)]
int somedata { get; set;}
}
Also should be done like above in protobuf-net? assign version in constructor which will get override if class is getting desiralized. for new objects to be serialized it will use version 1