YamlDocument.ParseAsync Method
Definition
Namespace: Corvus.Yaml
Assembly: Corvus.Text.Json.dll
ParseAsync(Stream, YamlReaderOptions, CancellationToken)
Parses UTF-8 YAML from a Stream asynchronously and returns a JsonDocument containing the equivalent JSON representation. The stream will be read to completion.
public static Task<JsonDocument> ParseAsync(Stream utf8YamlStream, YamlReaderOptions options, CancellationToken cancellationToken)
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
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