ReadInto(TomlReader, Object?) Method

Definition

Namespace Tomlyn
Assembly Tomlyn.dll

Reads a value from an existing TOML reader, populating an existing CLR instance when supported.

public virtual object? ReadInto(TomlReader reader, object? existingValue)

Parameters

reader
TomlReader

The TOML reader positioned at the value to read.

existingValue
Object

The existing CLR value to populate, if any.

Returns

Object
The populated or replacement value.

Remarks

The return value is the effective deserialized value for the caller to use. Implementations can return the original populated instance or a replacement value. Returning the effective value is required for populate scenarios involving structs and nullable value types, where a modified copy must be reassigned by the caller. The default implementation ignores existingValue and falls back to ReadAsObject(TomlReader), which preserves replace semantics for metadata that does not support in-place population.