Open GoogleCodeExporter opened 9 years ago
This issue can be fixed using a backing property as shown below.
[ProtoMember(1)]
private byte[] _data
{
get;
set;
}
public float[] Data
{
get
{
return Array.ConvertAll<byte, float>(_data, b => Convert.ToSingle(b)*0.1f);
}
}
This ensures the wire data is only a byte array, but the client has access to
the float array containing the correct values.
Additionally, the memory stream should be seek to 0 before deserializing in the
provider example.
Serializer.Serialize(ms, dto);
ms.Seek(0, SeekOrigin.Begin) // ADDED
var newDTO = Serializer.Deserialize<DTO>(ms);
Console.Read();
Original comment by dBurns.2...@gmail.com
on 15 Mar 2012 at 6:41
Original issue reported on code.google.com by
dBurns.2...@gmail.com
on 14 Mar 2012 at 8:07Attachments: