As the third option, you can use [XmlType] and [XmlElement(Order=n)] ... but I donβt think this is what you mean: p
In "v2" this is really possible. You do not need to define .proto - you can simply tell what to do at runtime, for example:
var model = TypeModel.Create(); model.Add(typeof(SomeType)).Add("Foo", "Bar", "Blip");
now save the model somewhere (and reuse it) and use model.Serialize(...) and model.Deserialize(...) . The above SomeType configuration for serializing .Foo (as field 1), .Bar (as field 2) and .Blip (as field 3). Of course, there are many ways to do this for finer control.
It will generate (primarily) a serializer (using IL emit, so very fast) that will work with your types as expected.
There is a downloadable "v2" DLL, but it needs to be updated - in the last few weeks I have made many corrections. I will try to update this dll later today, or you can build from code.
source share