This is specific to protobuf-net. If you're using v3, the main usage here is to provide explicit names for the enum and (via ProtoEnumAttribute) the defined values; the names only matter if you are generating a .proto from a code-first model (GetSchema(), GetProto<T>(), etc)
In v2, you can *also* use ProtoEnumAttribute to provide explicit serialization values different to the natural value, or you can tell it to *always* use natural values (with no attempt to consider mapped values) via EnumPassthru on ProtoContractAttribute, however: these features are deprecated in v3 - enums are now *always* treated as direct pass-thru values with no attempt to map values. On Fri, 21 May 2021 at 07:56, Rashmi Vijay <[email protected]> wrote: > What is the difference it makes if we decorate the enum with ProtoContract > in C# enum while doing Protobuf Serialization. I do get the value when i do > deserialization irrespective of that Attribute on Enum. Then what is the > best Practice? > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/protobuf/1c8d3097-c2c5-4f6d-a80b-c89ff7f05272n%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/1c8d3097-c2c5-4f6d-a80b-c89ff7f05272n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Regards, Marc -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CAF95VAwMSPs%3D455XXZfA0fEpXQQHuJfFYP6mKd-YcDOo%2B1zsDA%40mail.gmail.com.
