jefffhaynes / BinarySerializer

A declarative serialization framework for controlling formatting of data at the byte and bit level using field bindings, converters, and code.
MIT License
290 stars 62 forks source link

Fails to Serialize when field type is Dictionary or Implements [IDictionary] #188

Closed jwxNobody closed 2 years ago

jwxNobody commented 2 years ago

Are there any plans to add support for Dictionaries?

public Dictionary<string, object> Items { get; set; }

Exception occurs when attempt to serialize: {"Cannot serialize objects that implement IDictionary."}

jefffhaynes commented 2 years ago

A dictionary doesn't really have meaning in the context of serialization since it represents a way of looking something up. If you are looking to serialize a list of key/value pairs, then I recommend just doing that as it will allow you to control the serialization of the pairs rather than me guessing how they should be serialized.

Alternatively, if you don't care how it gets serialized, this is probably the wrong library and I would recommend using something like protobuf or json.