YamlTypeInfoResolver class
Contains utilities and combinators acting on IYamlTypeInfoResolver.
Namespace: System.Text.Yaml.Serialization.Metadata ยท Assembly: Styml.dll
public static class YamlTypeInfoResolver
Contains utilities and combinators acting on IYamlTypeInfoResolver.
MethodsLink to this heading
CombineLink to this heading
Combines multiple IYamlTypeInfoResolver sources into one.
public static IYamlTypeInfoResolver Combine(params IYamlTypeInfoResolver?[] resolvers);
Parameters
resolvers: Sequence of contract resolvers to be queried for metadata.
Returns: A IYamlTypeInfoResolver combining results from resolvers.
| Exception | Condition |
|---|---|
| ArgumentException | resolvers is null. |
The combined resolver will query each of resolvers in the specified order, returning the first result that is non-null. If all resolvers return null, then the combined resolver will also return null. Can be used to combine multiple YamlSerializerContext sources, which typically define contract metadata for small subsets of types. It can also be used to fall back to DefaultYamlTypeInfoResolver wherever necessary.
Combines multiple IYamlTypeInfoResolver sources into one.
public static IYamlTypeInfoResolver Combine(ReadOnlySpan<IYamlTypeInfoResolver?> resolvers);
Parameters
resolvers: Sequence of contract resolvers to be queried for metadata.
Returns: A IYamlTypeInfoResolver combining results from resolvers.
The combined resolver will query each of resolvers in the specified order, returning the first result that is non-null. If all resolvers return null, then the combined resolver will also return null. Can be used to combine multiple YamlSerializerContext sources, which typically define contract metadata for small subsets of types. It can also be used to fall back to DefaultYamlTypeInfoResolver wherever necessary.
WithAddedModifierLink to this heading
Creates a resolver applies modifications to the metadata generated by the source resolver.
public static IYamlTypeInfoResolver WithAddedModifier(this IYamlTypeInfoResolver resolver, Action<YamlTypeInfo> modifier);
Parameters
resolver: The source resolver generatingYamlTypeInfometadata.modifier: The delegate modifying non-nullYamlTypeInforesults.
Returns: A new IYamlTypeInfoResolver instance applying the modifications.
This method is closely related to DefaultYamlTypeInfoResolver.Modifiers property extended to arbitrary IYamlTypeInfoResolver instances.