YamlStreamDocument Class

A document of a YamlStream: its directives and markers, and its root node in YamlStreamDocument.Contents.

public class YamlStreamDocument

Remarks

For a read-only document that does not create an object per node, see YamlDocument.

Constructors

NameDescription
YamlStreamDocument()Initializes a new instance of this type.

YamlStreamDocument()

YamlStreamDocument.cs

Initializes a new instance of this type.

public YamlStreamDocument()

Properties

NameDescription
ContentsGets contents.
DocumentEndGets document End.
DocumentStartGets document Start.

Gets contents.

public YamlNode? Contents { get; set; }

Property value

YamlNode?

Gets document End.

public DocumentEnd DocumentEnd { get; set; }

Property value

DocumentEnd

Gets document Start.

public DocumentStart DocumentStart { get; set; }

Property value

DocumentStart

Methods

NameDescription
DeepClone()Creates a deep clone of the current value.
EnumerateEvents()Enumerates the parsing events of the document.
Load(EventReader)Loads data.
Load(EventReader, YamlSerializerOptions?)Loads data, honoring the anchor, alias and alias-expansion limits of options.
ToObject(Type, YamlSerializerOptions?)Converts the document to an object.
ToObject<T>(YamlSerializerOptions?)Converts the document to an instance of T.
ToString()Returns a string representation of the current instance.
WriteTo(IEmitter, bool)Writes the document as YAML.
WriteTo(TextWriter, bool)Writes the document as YAML.

Creates a deep clone of the current value.

public YamlStreamDocument DeepClone()

EnumerateEvents()

YamlStreamDocument.cs

Enumerates the parsing events of the document.

public IEnumerable<ParsingEvent> EnumerateEvents()

Load overloads

Load(EventReader)

YamlStreamDocument.cs

Loads data.

public static YamlStreamDocument Load(EventReader eventReader)
Parameters
eventReader EventReader
Returns

YamlStreamDocument

Load(EventReader, YamlSerializerOptions?)

YamlStreamDocument.cs

Loads data, honoring the anchor, alias and alias-expansion limits of options.

public static YamlStreamDocument Load(EventReader eventReader, YamlSerializerOptions? options)
Parameters
eventReader EventReader
The event reader.
options YamlSerializerOptions?
The options used to bound alias expansion. If null, YamlSerializerOptions.Default is used.
Returns

YamlStreamDocument

ToObject overloads

ToObject(Type, YamlSerializerOptions?)

YamlStreamDocument.cs

Converts the document to an object.

public object? ToObject(Type type, YamlSerializerOptions? options = null)
Parameters
type Type
options YamlSerializerOptions?
Returns

object?

ToObject<T>(YamlSerializerOptions?)

YamlStreamDocument.cs

Converts the document to an instance of T.

public T? ToObject<T>(YamlSerializerOptions? options = null)
Type parameters
T
Parameters
options YamlSerializerOptions?
Returns

T?

Returns a string representation of the current instance.

public override string ToString()

Returns

string

WriteTo overloads

WriteTo(IEmitter, bool)

YamlStreamDocument.cs

Writes the document as YAML.

public void WriteTo(IEmitter emitter, bool suppressDocumentTags = false)
Parameters
emitter IEmitter
suppressDocumentTags bool

WriteTo(TextWriter, bool)

YamlStreamDocument.cs

Writes the document as YAML.

public void WriteTo(TextWriter writer, bool suppressDocumentTags = false)
Parameters
writer TextWriter
suppressDocumentTags bool