Skip to content

YamlDocument.EnumerateEvents Method

Definition

Namespace: Corvus.Text.Json.Yaml
Assembly: Corvus.Text.Json.dll

Overloads

Method Description
EnumerateEvents(ReadOnlySpan<byte>, YamlEventCallback, YamlReaderOptions) Enumerates the YAML parse events from UTF-8 YAML bytes, invoking the specified callback for each event.
EnumerateEvents(string, YamlEventCallback, YamlReaderOptions) Enumerates the YAML parse events from a YAML string, invoking the specified callback for each event.

EnumerateEvents(ReadOnlySpan<byte>, YamlEventCallback, YamlReaderOptions)

Enumerates the YAML parse events from UTF-8 YAML bytes, invoking the specified callback for each event.

public static bool EnumerateEvents(ReadOnlySpan<byte> utf8Yaml, YamlEventCallback callback, YamlReaderOptions options)

Parameters

Name Type Description
utf8Yaml ReadOnlySpan<byte> The UTF-8 encoded YAML bytes.
callback YamlEventCallback A callback invoked for each YAML event. Return true to continue parsing or false to stop early. The YamlEvent and its spans are only valid for the duration of the callback.
options YamlReaderOptions Optional YAML reader options. (optional)

Returns

bool

true if parsing completed normally; false if the callback returned false to stop early.

Exceptions

Exception Description
YamlException The YAML content is invalid.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

EnumerateEvents(string, YamlEventCallback, YamlReaderOptions)

Enumerates the YAML parse events from a YAML string, invoking the specified callback for each event.

public static bool EnumerateEvents(string yaml, YamlEventCallback callback, YamlReaderOptions options)

Parameters

Name Type Description
yaml string The YAML content as a string.
callback YamlEventCallback A callback invoked for each YAML event. Return true to continue parsing or false to stop early. The YamlEvent and its spans are only valid for the duration of the callback.
options YamlReaderOptions Optional YAML reader options. (optional)

Returns

bool

true if parsing completed normally; false if the callback returned false to stop early.

Exceptions

Exception Description
YamlException The YAML content is invalid.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests.

Open an issue