YamlObject Class
Definition
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
keystringThe mapping key.
Property Value
Exceptions
- ArgumentNullException
keyis 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
Exceptions
- ArgumentNullException
keyis 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
keystringThe key to locate.
Returns
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
keystringThe key to remove.
Returns
TryGetValue(string, out YamlNode?)
Attempts to get the node mapped to the specified key.
public bool TryGetValue(string key, out YamlNode? value)
Parameters
Returns
WriteTo(Utf8YamlWriter)
Writes this node to the given writer.
public override void WriteTo(Utf8YamlWriter writer)
Parameters
writerUtf8YamlWriterThe 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
| Product | Versions |
|---|---|
| .NET | 8, 10 |