Enum SerializeDefaultValuesPolicy
- Namespace
- Nerdbank.MessagePack
- Assembly
- Nerdbank.MessagePack.dll
Specifies the policy for serializing default values.
[Flags]
public enum SerializeDefaultValuesPolicy
Fields
Always = Required | ValueTypes | ReferenceTypesSerialize all properties, regardless of their values.
Never = 0Do 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 = 4Serialize default values for reference types.
This means that properties with null values will be serialized.
Required = 1Serialize default values when they are required by the schema.
Properties are considered required when they have the
requiredmodifier on them or they appear as parameters in the deserializing constructor without a default value specified.ValueTypes = 2Serialize default values for value types.
This means values such as
0and false will be serialized, but null will not be serialized.