YamlDuplicateKeyBehavior Enum
Definition
- Assembly
- Bodu.Text.Yaml.dll
- Package
- Bodu.Text.Yaml 1.0.0
Specifies how the reader and document layers treat a mapping that declares the same key more than once.
public enum YamlDuplicateKeyBehavior
- Extension Methods
Fields
Throw = 0Reject a duplicate key by throwing YamlFormatException. This is the default and the only specification-conformant behavior.
UseFirst = 1Keep the first occurrence of a duplicated key and discard later occurrences.
UseLast = 2Keep the last occurrence of a duplicated key, replacing any earlier occurrence.
Remarks
The YAML specification requires mapping keys to be unique, and duplicate-key ambiguity is a common source of configuration-parsing defects, so the default is Throw. The non-throwing modes exist only for interoperability with lenient producers and resolve the ambiguity deterministically across the document object models and the serializer.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |