Table of Contents

YamlDuplicateKeyBehavior Enum

Definition

Namespace
Bodu.Text.Yaml
Assembly
Bodu.Text.Yaml.dll
Package
Bodu.Text.Yaml 1.0.0
Source
YamlDuplicateKeyBehavior.cs

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 = 0

Reject a duplicate key by throwing YamlFormatException. This is the default and the only specification-conformant behavior.

UseFirst = 1

Keep the first occurrence of a duplicated key and discard later occurrences.

UseLast = 2

Keep 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

ProductVersions
.NET8, 10