In my solution, I have created public class to store value and already declare [DataContract/DataMember] attribute.
For example,
[DataContract]
public class MeterSizeInfo
{
string _meterSizeId;
[DataMember(Order = 1)]
public string MeterSizeId
{
get { return this._meterSizeId; }
set { this._meterSizeId = value; }
}
string _meterSizeName;
[DataMember(Order = 2)]
public string MeterSizeName
{
get { return this._meterSizeName; }
set { this._meterSizeName = value; }
}
}
Then I need to add another public method exposing to entire project. I wonder I have to add [DataMember(Order = 3)] for it or not.
[DataMember(Order = 3)] //<--- must declare or not?
public string DoSomething()
{
// do something...
}
I understand that if I want to use serializer in protobuf-net to serialize my data stored in, I have to declare those attribute. but I'm not sure about that on method.
please help. Thank you in advance.