c# - Can Protobuf.Net Serialize a Dynamic Dictionary? -
i have dictionary dynamic.
public dictionary<int, dynamic> data = new dictionary<int, dynamic>();
the dynamic portion contain simple classes consisting of 5-6 get/set properties instance classes like.
public class class1 { public int property1 { get; set; } public int property2 { get; set; } }
and
public class class2 { public string property1 { get; set; } public string property2 { get; set; } }
i tried adding these 2 classes dictionary , serializing dictionary received error. wondering if protobuf.net able serialize , de-serialize such dictionary? , if so, how accomplished?
the short answer "not really". there ways made work, wouldn't recommend - hard maintain.
protobuf-net (and protobuf generally) works best when serializer knows structure in advance.
Comments
Post a Comment