IniElement Struct
Definition
Represents a single element within an IniDocument - the root object, a section object, or a string
value - shaped after System.Text.Json's JsonElement.
public readonly struct IniElement
- Inherited Members
- Extension Methods
Remarks
The root object's properties are the document's hoisted global keys (string values) followed by its sections (object values); a section object's properties are its key/value entries.
Properties
ValueKind
Gets the value kind of this element.
public IniValueKind ValueKind { get; }
Property Value
Methods
EnumerateObject()
Enumerates the properties of an object element: for the root, the hoisted global keys followed by the sections; for a section, its key/value entries.
public IniElement.ObjectEnumerator EnumerateObject()
Returns
- IniElement.ObjectEnumerator
An enumerator over the object's properties.
Exceptions
- InvalidOperationException
Thrown when this element is not an object.
- ObjectDisposedException
Thrown when the owning document has been disposed.
GetProperty(string)
Gets the value element for the specified property name.
public IniElement GetProperty(string name)
Parameters
namestringThe property name - a global key or section name on the root, or an entry key on a section.
Returns
- IniElement
The value element.
Exceptions
- ArgumentNullException
Thrown when
nameis null.- InvalidOperationException
Thrown when this element is not an object.
- KeyNotFoundException
Thrown when the property is not present.
- ObjectDisposedException
Thrown when the owning document has been disposed.
GetString()
Gets the string value of an String element.
public string GetString()
Returns
- string
The string value.
Exceptions
- InvalidOperationException
Thrown when this element is not a string.
- ObjectDisposedException
Thrown when the owning document has been disposed.
TryGetProperty(string, out IniElement)
Attempts to get the value element for the specified property name.
public bool TryGetProperty(string name, out IniElement value)
Parameters
namestringThe property name - a global key or section name on the root, or an entry key on a section.
valueIniElementWhen this method returns true, the value element; otherwise the default element.
Returns
Exceptions
- ArgumentNullException
Thrown when
nameis null.- InvalidOperationException
Thrown when this element is not an object.
- ObjectDisposedException
Thrown when the owning document has been disposed.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |