Enum DeserializeDefaultValuesPolicy
- Namespace
- Nerdbank.MessagePack
- Assembly
- Nerdbank.MessagePack.dll
Enumerates policies that control how deserialization handles default values.
[Flags]
public enum DeserializeDefaultValuesPolicy
Fields
AllowMissingValuesForRequiredProperties = 3
Allows deserialization to succeed even if required properties are not specified in the data stream. These will be left at their default values.
This flag includes AllowNullValuesForNonNullableProperties, since accepting missing values will tend to leave reference typed properties at their default null values.
AllowNullValuesForNonNullableProperties = 1
Allow a null value to be deserialized into a non-nullable property.
Default = 0
Deserialization will fail if any required properties have no specified values in the data stream, or when null values are encountered for non-nullable properties.
The non-nullability enforcement by the deserializer is limited to parameters, properties and fields that are not typed as generic type parameters. Collection elements (e.g. arrays, lists, or dictionary elements) that would not allow null values based on nullable ref annotations are not covered by this guarantee. After deserializing an object graph, you should be cautious that (for example) a
List<string>
may contain null elements even though the type argument is notstring?
.