Parser Class

Represents the Parser.

public static class Parser

Methods

NameDescription
CreateParser(TextReader)Creates a YAML parser with the default maximum nesting depth.
CreateParser(TextReader, int)Creates a YAML parser with a configurable maximum nesting depth.
CreateParser(TextReader, int, string?)Creates a YAML parser with a configurable maximum nesting depth and optional source name.

CreateParser overloads

CreateParser(TextReader)

Parser.cs

Creates a YAML parser with the default maximum nesting depth.

public static IParser CreateParser(TextReader reader)
Parameters
reader TextReader
The YAML reader.
Returns

IParser The parser.

Exceptions
ArgumentNullException
reader is null.

CreateParser(TextReader, int)

Parser.cs

Creates a YAML parser with a configurable maximum nesting depth.

public static IParser CreateParser(TextReader reader, int maxDepth)
Parameters
reader TextReader
The YAML reader.
maxDepth int
The maximum allowed nesting depth for mappings and sequences. A value of 0 uses the default limit of 64.
Returns

IParser The parser.

Exceptions
ArgumentNullException
reader is null.
ArgumentOutOfRangeException
maxDepth is less than 0.

CreateParser(TextReader, int, string?)

Parser.cs

Creates a YAML parser with a configurable maximum nesting depth and optional source name.

public static IParser CreateParser(TextReader reader, int maxDepth, string? sourceName)
Parameters
reader TextReader
The YAML reader.
maxDepth int
The maximum allowed nesting depth for mappings and sequences. A value of 0 uses the default limit of 64.
sourceName string?
An optional source name associated with the YAML payload, such as a file path, used when reporting depth-limit failures.
Returns

IParser The parser.

Exceptions
ArgumentNullException
reader is null.
ArgumentOutOfRangeException
maxDepth is less than 0.