YamlTypeInfo<T> Class

Represents metadata and operations for a specific serializable type.

public abstract class YamlTypeInfo<T> : YamlTypeInfo

Type parameters

T
The represented CLR type.
Inheritance
YamlTypeInfo YamlTypeInfo<T>

Constructors

NameDescription
YamlTypeInfo(YamlSerializerOptions)Initializes a new instance of the YamlTypeInfo<T> class.

YamlTypeInfo(YamlSerializerOptions)

YamlTypeInfo.cs

Initializes a new instance of the YamlTypeInfo<T> class.

protected YamlTypeInfo(YamlSerializerOptions options)

Parameters

options YamlSerializerOptions
The options associated with the metadata.

Methods

NameDescription
Read(YamlReader)Reads a value from an existing YAML reader.
ReadAsObject(YamlReader)Reads a value from an existing YAML reader.
Write(YamlWriter, object?)Writes a value to an existing YAML writer.
Write(YamlWriter, T)Writes a value to an existing YAML writer.

Read(YamlReader)

Reads a value from an existing YAML reader.

public abstract T? Read(YamlReader reader)

Parameters

reader YamlReader
The reader positioned on the value token.

Returns

T? The deserialized value.

ReadAsObject(YamlReader)

YamlTypeInfo.cs

Reads a value from an existing YAML reader.

public override object? ReadAsObject(YamlReader reader)

Parameters

reader YamlReader
The reader positioned on the value token.

Returns

object? The deserialized value.

Write overloads

Write(YamlWriter, object?)

YamlTypeInfo.cs

Writes a value to an existing YAML writer.

public override void Write(YamlWriter writer, object? value)
Parameters
writer YamlWriter
The writer that receives the value payload.
value object?
The value to serialize.
Exceptions
ArgumentNullException
writer is null.

Write(YamlWriter, T)

Writes a value to an existing YAML writer.

public abstract void Write(YamlWriter writer, T value)
Parameters
writer YamlWriter
The writer that receives the value payload.
value T
The value to serialize.
Exceptions
ArgumentNullException
writer is null.