YamlSerializerContext class
Provides metadata about a set of types that is relevant to YAML serialization.
Namespace: System.Text.Yaml.Serialization ยท Assembly: Styml.dll
public abstract class YamlSerializerContext : IYamlTypeInfoResolver
Implements: IYamlTypeInfoResolver
Provides metadata about a set of types that is relevant to YAML serialization.
ConstructorsLink to this heading
Creates an instance of YamlSerializerContext and binds it with the indicated YamlSerializerOptions.
protected YamlSerializerContext(YamlSerializerOptions? options);
Parameters
options: The run time provided options for the context instance.
If no instance options are passed, then no options are set until YamlSerializerContext.Options is called, where a new options instance is created and bound.
PropertiesLink to this heading
GeneratedSerializerOptionsLink to this heading
The default run time options for the context. Its values are defined at design-time via YamlSourceGenerationOptionsAttribute.
protected abstract YamlSerializerOptions? GeneratedSerializerOptions { get; }
OptionsLink to this heading
Gets the run time specified options of the context. If no options were passed when instantiating the context, then a new instance is bound and returned.
public YamlSerializerOptions Options { get; }
The options instance cannot be mutated once it is bound to the context instance.
MethodsLink to this heading
GetTypeInfoLink to this heading
Returns a YamlTypeInfo instance representing the given type.
public abstract YamlTypeInfo? GetTypeInfo(Type type);
Parameters
type: The type to fetch metadata about.
Returns: The metadata for the specified type, or null if the context has no metadata for the type.