ReferenceResolver class

This class defines how the YamlSerializer deals with references on serialization and deserialization. Defines the core behavior of preserving references on serialization and deserialization.

Namespace: System.Text.Yaml.Serialization ยท Assembly: Styml.dll

public abstract class ReferenceResolver

This class defines how the YamlSerializer deals with references on serialization and deserialization. Defines the core behavior of preserving references on serialization and deserialization.

ConstructorsLink to this heading

protected ReferenceResolver();

MethodsLink to this heading

AddReferenceLink to this heading

Adds an entry to the bag of references using the specified id and value. This method gets called when an $id metadata property from a YAML object is read.

public abstract void AddReference(string referenceId, object value);

Parameters

  • referenceId: The identifier of the respective YAML object or array.
  • value: The value of the respective CLR reference type object that results from parsing the YAML object.

GetReferenceLink to this heading

Gets the reference identifier of the specified value if exists; otherwise a new id is assigned. This method gets called before a CLR object is written so we can decide whether to write $id and enumerate the rest of its properties or $ref and step into the next object.

public abstract string GetReference(object value, out bool alreadyExists);

Parameters

  • value: The value of the CLR reference type object to get an id for.
  • alreadyExists: When this method returns, true if a reference to value already exists; otherwise, false.

Returns: The reference id for the specified object.

ResolveReferenceLink to this heading

Returns the CLR reference type object related to the specified reference id. This method gets called when $ref metadata property is read.

public abstract object ResolveReference(string referenceId);

Parameters

  • referenceId: The reference id related to the returned object.

Returns: The reference type object related to specified reference id.

Generated from the XML documentation of the libraryBuilt with Douze

Esc to close