It is possible to serialize only a few properties of the class? ex:
public class Client
{
[ProtoMember(1)]
public int Id { get; set; }
[ProtoMember(2)]
public string Name { get; set; }
public int Age { get; set; }
[ProtoMember(3)]
public string Guid { get; set; }
}
Thus, I get the value of "Id" incorrect. The other properties are correct. If I fill it with "[ProtoMember]" all the properties, the value of "id" is correct. Why?
Actually the error is caused by other reasons you may be able to help me.
I convert String to Stream to perform tasks. In time to reverse this conversion I have error in the value of Id
var cli = new Client
{ Id = 222, Guid = "52369-fe5r6-74e2g-j1i4e", Age = 29, Name = "José"};
//Serialize
var ms = new MemoryStream();
Serializer.Serialize(ms, cli);
ms.Position = 0;
var reader = new StreamReader(ms);
var strStream = reader.ReadToEnd();
//Deserialize
var ms2 = new MemoryStream(Encoding.UTF8.GetBytes(strStream));
var obj = Serializer.Deserialize<Client>(ms2);
Thus, any value above 127, is converted to a different Int. Ex: 3104751
My conversion is wrong?
Obs: I'm sorry the poor English