YamlIgnoreCondition enum
When specified on YamlSerializerOptions.DefaultIgnoreCondition, determines when properties and fields across the type graph are ignored. When specified on YamlIgnoreAttribute.Condition, controls whether a property or field is ignored during serialization and deserialization. This option overrides the setting on YamlSerializerOptions.DefaultIgnoreCondition.
Namespace: System.Text.Yaml.Serialization ยท Assembly: Styml.dll
public enum YamlIgnoreCondition
When specified on YamlSerializerOptions.DefaultIgnoreCondition, determines when properties and fields across the type graph are ignored. When specified on YamlIgnoreAttribute.Condition, controls whether a property or field is ignored during serialization and deserialization. This option overrides the setting on YamlSerializerOptions.DefaultIgnoreCondition.
FieldsLink to this heading
| Name | Value | Description |
|---|---|---|
Never |
0 | Property is never ignored during serialization or deserialization. |
Always |
1 | Property is always ignored during serialization and deserialization. |
WhenWritingDefault |
2 | If the value is the default, the property is ignored during serialization. This is applied to both reference and value-type properties and fields. |
WhenWritingNull |
3 | If the value is null, the property is ignored during serialization. This is applied only to reference-type properties and fields. |
WhenWriting |
4 | Property is ignored during serialization |
WhenReading |
5 | Property is ignored during deserialization |
WhenWritingEmptyCollection |
6 | If the value is null or an empty collection, the property is ignored during serialization as YamlDotNet's OmitNull \| OmitEmptyCollections. A collection is empty when its count, known without enumerating it, is 0 (an array, an ICollection, an IReadOnlyCollection<T>, a default or empty ImmutableArray<T>); a collection with no known count is written. An object member is judged by its value's runtime type. On a member that is not a collection this acts as YamlIgnoreCondition.WhenWritingNull. An omitted member is not in the output, so on read it keeps what the constructor or its initializer gave it. |