此类型在程序集中定义,我无法添加对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;
...
}
如何使用ProtoBuf.Meta.RuntimeTypeModel.Default
指定zig-zag存储来优化输出大小?
答案 0 :(得分:0)
var metaType = RuntimeTypeModel.Default.Add(typeof(PointI), true);
metaType[1].DataFormat = metaType[2].DataFormat = ProtoBuf.DataFormat.ZigZag;
那是吗?在其他新闻中:可变结构......喋喋不休......