Enum SerializeDefaultValuesPolicy
- Namespace
- Nerdbank.MessagePack
- Assembly
- Nerdbank.MessagePack.dll
Specifies the policy for serializing default values.
[Flags]
public enum SerializeDefaultValuesPolicy
Fields
Always = Required | ValueTypes | ReferenceTypes
Serialize all properties, regardless of their values.
Never = 0
Do not serialize any default values.
Use this setting with care, because it can break round-tripping of data types that consider properties to be required. Consider setting AllowMissingValuesForRequiredProperties on DeserializeDefaultValues when using this setting.
ReferenceTypes = 4
Serialize default values for reference types.
This means that properties with null values will be serialized.
Required = 1
Serialize default values when they are required by the schema.
Properties are considered required when they have the
required
modifier on them or they appear as parameters in the deserializing constructor without a default value specified.ValueTypes = 2
Serialize default values for value types.
This means values such as
0
and false will be serialized, but null will not be serialized.