var metaType = RuntimeTypeModel.Default.Add(typeof(PointI), true);
metaType[1].DataFormat = metaType[2].DataFormat = ProtoBuf.DataFormat.ZigZag;
That do ? In other news: mutable structs... bleugh...
Question
This type is defined in an assembly where I cannot add a reference to protobuf-net:
[StructLayout(LayoutKind.Sequential)]
[XmlType] // for XML or protobuf-net serialization
public struct PointI
{
public PointI(int x, int y) { X = x; Y = y; }
[XmlElement(Order = 1)]
public int X;
[XmlElement(Order = 2)]
public int Y;
...
}
How can I use ProtoBuf.Meta.RuntimeTypeModel.Default
to specify zig-zag storage to optimize output size?
La solution
var metaType = RuntimeTypeModel.Default.Add(typeof(PointI), true);
metaType[1].DataFormat = metaType[2].DataFormat = ProtoBuf.DataFormat.ZigZag;
That do ? In other news: mutable structs... bleugh...