Table of Contents

DelimitedElement Struct

Definition

Namespace
Bodu.Text.Delimited.Document
Assembly
Bodu.Text.Delimited.dll
Package
Bodu.Text.Delimited 1.0.0
Source
DelimitedElement.cs

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

index int

The 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

name string

The column name.

Returns

DelimitedElement

The field value element.

Exceptions

ArgumentNullException

Thrown when name is 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

name string

The column name.

value DelimitedElement

When this method returns true, the field element; otherwise the default element.

Returns

bool

true when the column is present with a value in this record.

Exceptions

ArgumentNullException

Thrown when name is null.

InvalidOperationException

Thrown when this element is not an object.

ObjectDisposedException

Thrown when the owning document has been disposed.

Applies to

ProductVersions
.NET8, 10