Struct ObjectConverterOptions
- Namespace
- Nerdbank.MessagePack
- Assembly
- Nerdbank.MessagePack.dll
Options for the object converter added by WithObjectConverter(MessagePackSerializer, ObjectConverterOptions).
public struct ObjectConverterOptions
- Inherited Members
Properties
PreserveIntegerTypes
Gets or sets a value indicating whether integer types are preserved during serialization and deserialization.
public bool PreserveIntegerTypes { readonly get; set; }
Property Value
Remarks
When true, integers are serialized using the msgpack encoding that matches their .NET type's width (e.g. int uses Int32). This allows the original integer type to be recovered during deserialization based on the msgpack encoding.
When false (the default), integers are serialized using the most compact msgpack encoding, and deserialized as ulong (or long if the value is negative).
Note that only msgpack data written with this option enabled can guarantee type preservation. Data received from other sources may use compact encodings, in which case the integer will be deserialized based on the encoding actually present in the msgpack data.