Table of Contents

YamlObject Class

Definition

Namespace
Bodu.Text.Yaml.Nodes
Assembly
Bodu.Text.Yaml.dll
Package
Bodu.Text.Yaml 1.0.0
Source
YamlObject.cs

Represents a mutable YAML mapping node whose entries preserve insertion order.

public sealed class YamlObject : YamlNode, IEnumerable<KeyValuePair<string, YamlNode?>>, IEnumerable
Inheritance
YamlObject
Implements
Inherited Members
Extension Methods

Constructors

YamlObject()

public YamlObject()

Properties

Count

Gets the number of entries in the mapping.

public int Count { get; }

Property Value

int

The entry count.

this[string]

Gets or sets the node mapped to the specified key, adding it when absent.

public override YamlNode? this[string key] { get; set; }

Parameters

key string

The mapping key.

Property Value

YamlNode

The mapped node, or null.

Exceptions

ArgumentNullException

key is null.

Keys

Gets the keys of the mapping in insertion order.

public IReadOnlyList<string> Keys { get; }

Property Value

IReadOnlyList<string>

The ordered keys.

Methods

Add(string, YamlNode?)

Adds an entry to the mapping.

public void Add(string key, YamlNode? value)

Parameters

key string

The entry key.

value YamlNode

The entry value.

Exceptions

ArgumentNullException

key is null.

ArgumentException

An entry with the same key already exists.

ContainsKey(string)

Determines whether the mapping contains the specified key.

public bool ContainsKey(string key)

Parameters

key string

The key to locate.

Returns

bool

true when the key is present.

GetEnumerator()

Returns an enumerator over the entries in insertion order.

public IEnumerator<KeyValuePair<string, YamlNode?>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<string, YamlNode>>

The entry enumerator.

Remove(string)

Removes the entry with the specified key.

public bool Remove(string key)

Parameters

key string

The key to remove.

Returns

bool

true when an entry was removed.

TryGetValue(string, out YamlNode?)

Attempts to get the node mapped to the specified key.

public bool TryGetValue(string key, out YamlNode? value)

Parameters

key string

The key to locate.

value YamlNode

When the method returns true, the mapped node.

Returns

bool

true when the key is present.

WriteTo(Utf8YamlWriter)

Writes this node to the given writer.

public override void WriteTo(Utf8YamlWriter writer)

Parameters

writer Utf8YamlWriter

The writer to emit into.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

IEnumerator IEnumerable.GetEnumerator()

Returns

IEnumerator

An IEnumerator object that can be used to iterate through the collection.

Applies to

ProductVersions
.NET8, 10