YamlTypeInfo<T> Class
Represents metadata and operations for a specific serializable type.
public abstract class YamlTypeInfo<T> : YamlTypeInfoType parameters
T- The represented CLR type.
- Inheritance
YamlTypeInfoYamlTypeInfo<T>
Constructors
| Name | Description |
|---|---|
| YamlTypeInfo(YamlSerializerOptions) | Initializes a new instance of the YamlTypeInfo<T> class. |
YamlTypeInfo(YamlSerializerOptions)
YamlTypeInfo.csInitializes a new instance of the YamlTypeInfo<T> class.
protected YamlTypeInfo(YamlSerializerOptions options)Parameters
optionsYamlSerializerOptions- The options associated with the metadata.
Methods
| Name | Description |
|---|---|
| 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
readerYamlReader- The reader positioned on the value token.
Returns
T? The deserialized value.
ReadAsObject(YamlReader)
YamlTypeInfo.csReads a value from an existing YAML reader.
public override object? ReadAsObject(YamlReader reader)Parameters
readerYamlReader- The reader positioned on the value token.
Returns
object? The deserialized value.
Write overloads
Write(YamlWriter, object?)
YamlTypeInfo.csWrites a value to an existing YAML writer.
public override void Write(YamlWriter writer, object? value)Parameters
writerYamlWriter- The writer that receives the value payload.
valueobject?- The value to serialize.
Exceptions
ArgumentNullExceptionwriterisnull.
Write(YamlWriter, T)
Writes a value to an existing YAML writer.
public abstract void Write(YamlWriter writer, T value)Parameters
writerYamlWriter- The writer that receives the value payload.
valueT- The value to serialize.
Exceptions
ArgumentNullExceptionwriterisnull.