YamlDocument.ParseAsync Method
Definition
Namespace: Corvus.Text.Json.Yaml
Assembly: Corvus.Text.Json.dll
ParseAsync(Stream, YamlReaderOptions, CancellationToken)
Parses UTF-8 YAML from a Stream asynchronously and returns a ParsedJsonDocument containing the equivalent JSON representation. The stream will be read to completion.
public static Task<ParsedJsonDocument<TElement>> ParseAsync<TElement>(Stream utf8YamlStream, YamlReaderOptions options, CancellationToken cancellationToken)
where TElement : struct, IJsonElement<TElement>
Type Parameters
| Parameter | Description |
|---|---|
TElement |
The type of the JSON element. |
Parameters
| Name | Type | Description |
|---|---|---|
utf8YamlStream |
Stream |
The stream containing UTF-8 encoded YAML bytes. |
options |
YamlReaderOptions |
Optional YAML reader options. (optional) |
cancellationToken |
CancellationToken |
The token to monitor for cancellation requests. (optional) |
Returns
Task<ParsedJsonDocument<TElement>>
A task that represents the asynchronous parse operation.
Exceptions
| Exception | Description |
|---|---|
ArgumentNullException |
utf8YamlStream is null. |
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