YamlTypeClassifier delegate
A delegate that classifies a YAML payload to determine the concrete type it corresponds to. Used by both union types and polymorphic types with custom type classifiers.
Namespace: System.Text.Yaml.Serialization ยท Assembly: Styml.dll
public delegate Type? YamlTypeClassifier(ref Utf8YamlReader reader);
Inheritance: object โ Delegate โ MulticastDelegate โ YamlTypeClassifier
A delegate that classifies a YAML payload to determine the concrete type it corresponds to. Used by both union types and polymorphic types with custom type classifiers.
Parameters
reader: A defensive copy of the reader positioned at the start of the YAML value. The classifier is free to advance this reader for lookahead; the original reader is not affected.
RemarksLink to this heading
For union types, the classifier is not invoked when the payload is a YAML YamlTokenType.Null token. Per the union semantics, every nullable case produces the same canonical null-holding union value, so the case-type choice is irrelevant for null payloads. The converter dispatches null directly to the union's constructor delegate, which yields the canonical null union when at least one case is nullable, and otherwise throws a YamlException. Classifier authors therefore do not need to handle the YamlTokenType.Null token.