YamlTypeInfo Class

Represents metadata and operations for a serializable type.

public abstract class YamlTypeInfo

Constructors

NameDescription
YamlTypeInfo(Type, YamlSerializerOptions)Initializes a new instance of the YamlTypeInfo class.

YamlTypeInfo(Type, YamlSerializerOptions)

YamlTypeInfo.cs

Initializes a new instance of the YamlTypeInfo class.

protected YamlTypeInfo(Type type, YamlSerializerOptions options)

Parameters

type Type
The represented CLR type.
options YamlSerializerOptions
The options associated with the metadata.

Exceptions

ArgumentNullException
type or options is null.

Properties

NameDescription
OptionsGets the options associated with this metadata instance.
TypeGets the CLR type represented by this metadata.

Gets the options associated with this metadata instance.

public YamlSerializerOptions Options { get; }

Property value

YamlSerializerOptions

Gets the CLR type represented by this metadata.

public Type Type { get; }

Property value

Type

Methods

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

ReadAsObject(YamlReader)

Reads a value from an existing YAML reader.

public abstract object? ReadAsObject(YamlReader reader)

Parameters

reader YamlReader
The reader positioned on the value token.

Returns

object? The deserialized value.

Write(YamlWriter, object?)

Writes a value to an existing YAML writer.

public abstract 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.