YamlTypeClassifierFactory Class

Creates the YamlTypeClassifier used to select a union case from a YAML payload.

public abstract class YamlTypeClassifierFactory

Remarks

Register a factory through YamlSerializerOptions.TypeClassifiers. Without one, union cases are selected by YAML shape alone and a payload matching several cases fails to deserialize.

Constructors

NameDescription
YamlTypeClassifierFactory()

YamlTypeClassifierFactory()

protected YamlTypeClassifierFactory()

No documentation is available.

Methods

NameDescription
CanClassify(YamlTypeClassifierContext)Determines whether this factory can classify the type described by context.
CreateYamlClassifier(YamlTypeClassifierContext, YamlSerializerOptions)Creates the classifier for the type described by context.

CanClassify(YamlTypeClassifierContext)

Determines whether this factory can classify the type described by context.

public abstract bool CanClassify(YamlTypeClassifierContext context)

Parameters

context YamlTypeClassifierContext
The type being classified.

Returns

bool true when the factory can classify the type; otherwise false.

CreateYamlClassifier(YamlTypeClassifierContext, YamlSerializerOptions)

Creates the classifier for the type described by context.

public abstract YamlTypeClassifier CreateYamlClassifier(YamlTypeClassifierContext context, YamlSerializerOptions options)

Parameters

context YamlTypeClassifierContext
The type being classified.
options YamlSerializerOptions
The options the classifier is created for.

Returns

YamlTypeClassifier The classifier to select a case with.