DelimitedElement Struct
Definition
Represents a single element - the document array, a record, or a field value - within a
DelimitedDocument, shaped after System.Text.Json's JsonElement.
public readonly struct DelimitedElement
- Inherited Members
- Extension Methods
Properties
this[int]
Gets the element at the specified index within an array element.
public DelimitedElement this[int index] { get; }
Parameters
indexintThe zero-based index.
Property Value
- DelimitedElement
The child element.
Exceptions
- InvalidOperationException
Thrown when this element is not an array.
- ObjectDisposedException
Thrown when the owning document has been disposed.
ValueKind
Gets the value kind of this element.
public DelimitedValueKind ValueKind { get; }
Property Value
- DelimitedValueKind
The element's DelimitedValueKind.
Methods
EnumerateArray()
Enumerates the elements of an array element.
public DelimitedElement.ArrayEnumerator EnumerateArray()
Returns
- DelimitedElement.ArrayEnumerator
An enumerator over the array's elements.
Exceptions
- InvalidOperationException
Thrown when this element is not an array.
- ObjectDisposedException
Thrown when the owning document has been disposed.
EnumerateObject()
Enumerates the fields of a record object element in column order.
public DelimitedElement.ObjectEnumerator EnumerateObject()
Returns
- DelimitedElement.ObjectEnumerator
An enumerator over the record's fields.
Exceptions
- InvalidOperationException
Thrown when this element is not an object.
- ObjectDisposedException
Thrown when the owning document has been disposed.
GetArrayLength()
Gets the number of elements in an array element (records in the document, or fields in a positional record).
public int GetArrayLength()
Returns
- int
The element count.
Exceptions
- InvalidOperationException
Thrown when this element is not an array.
- ObjectDisposedException
Thrown when the owning document has been disposed.
GetProperty(string)
Gets the field value element for the specified column name within a record object.
public DelimitedElement GetProperty(string name)
Parameters
namestringThe column name.
Returns
- DelimitedElement
The field value element.
Exceptions
- ArgumentNullException
Thrown when
nameis null.- InvalidOperationException
Thrown when this element is not an object.
- KeyNotFoundException
Thrown when the column is not present.
- ObjectDisposedException
Thrown when the owning document has been disposed.
GetString()
Gets the string value of a field element.
public string GetString()
Returns
- string
The field value.
Exceptions
- InvalidOperationException
Thrown when this element is not a string.
- ObjectDisposedException
Thrown when the owning document has been disposed.
TryGetProperty(string, out DelimitedElement)
Attempts to get the field value element for the specified column name.
public bool TryGetProperty(string name, out DelimitedElement value)
Parameters
namestringThe column name.
valueDelimitedElementWhen this method returns true, the field 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 |