Enum HumlIgnoreCondition
- Namespace
- Huml.Net.Serialization
- Assembly
- Huml.Net.dll
Controls which properties are omitted from HUML serialisation output based on their runtime value.
[Flags]
public enum HumlIgnoreCondition
Fields
Always = WhenWritingNull | WhenWritingDefaultOmit every property unconditionally, regardless of its runtime value (including non-null, non-default values). Handled as an explicit named case in the serialiser — behaviour is unconditional omission, not a combination of WhenWritingNull and WhenWritingDefault. Numeric value
3.Never = 0No properties are omitted based on their value. This is the default behaviour, preserving all existing serialisation output unchanged.
WhenWritingDefault = 2Omit a property when its runtime value equals the CLR default for its type:
nullfor reference types, or the zero-value (e.g.0,false) for value types.For reference types this is a superset of WhenWritingNull: a reference-type property is omitted when its value is
null. For value types, properties are omitted when their value equals the result ofActivator.CreateInstance(propertyType)(i.e. the parameterless default).WhenWritingNull = 1Omit a property when its runtime value is
null. This flag never fires for value-type properties (e.g.int,bool), because value types cannot hold anullreference.
Remarks
This is a FlagsAttribute enum, so values can be combined with the bitwise OR operator.
Always has the numeric value 3 and omits every property unconditionally —
including non-null, non-default values — and is handled as a named special case, not via bit flags.
The naming and semantics are intentionally aligned with
System.Text.Json.JsonIgnoreCondition to ease adoption for developers already
familiar with the STJ API.
Precedence chain (highest to lowest): per-property [HumlProperty(OmitIfDefault = true)]
overrides class-level [HumlIgnoreDefaults], which overrides
HumlOptions.DefaultIgnoreCondition.