YamlTypeClassification Class
Applies the YamlSerializerOptions.TypeClassifiers of a reader to a YAML payload.
public static class YamlTypeClassificationRemarks
This type supports the serializer infrastructure and is not intended to be used directly from your code.
Methods
| Name | Description |
|---|---|
| Classify(YamlReader, YamlTypeClassifierContext, string?) | Selects the type matching the value reader is positioned on, when a classifier is registered for the type described by context. |
| ClassifyBufferedNode(YamlReader, string, YamlTypeClassifierContext) | Selects the type matching an already buffered value, when a classifier is registered for the type described by context. |
Classify(YamlReader, YamlTypeClassifierContext, string?)
YamlTypeClassification.csSelects the type matching the value reader is positioned on, when a classifier is registered for the type described by context.
public static Type? Classify(YamlReader reader, YamlTypeClassifierContext context, out string? bufferedNode)Parameters
readerYamlReader- The reader positioned at the start of the value.
contextYamlTypeClassifierContext- The type to classify and the candidates to select from.
bufferedNodestring?- Receives the buffered YAML of the value when a classifier ran, or
nullwhen no classifier is registered. Classification reads the value, so the caller must deserialize from a reader created over the buffered YAML rather than fromreader.
Returns
Type? The selected type, or null when no classifier is registered or the value cannot be classified.
Exceptions
ArgumentNullExceptionreaderorcontextisnull.
ClassifyBufferedNode(YamlReader, string, YamlTypeClassifierContext)
YamlTypeClassification.csSelects the type matching an already buffered value, when a classifier is registered for the type described by context.
public static Type? ClassifyBufferedNode(YamlReader reader, string bufferedNode, YamlTypeClassifierContext context)Parameters
readerYamlReader- The reader the value was buffered from, used for its options.
bufferedNodestring- The buffered YAML of the value to classify.
contextYamlTypeClassifierContext- The type to classify and the candidates to select from.
Returns
Type? The selected type, or null when no classifier is registered or the value cannot be classified.
Exceptions
ArgumentNullExceptionreader,bufferedNode, orcontextisnull.