YamlSerializerOptions
OfficeIMO.Yaml
Settings for YamlSerializer. An instance caches the metadata it creates, so reuse one per configuration. It becomes read-only when first used; changing it afterwards throws.
Inheritance
- object
- YamlSerializerOptions
Usage
Explore 21 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 5
- Property YamlObjectInfoValues<T>.PropertyMetadataInitializer
- Property YamlSerializerContext.Options
- Property YamlSerializerOptions.Default
- Property YamlTypeInfo.Options
- Property YamlTypeInfo<T>.Options
Accepted by parameters 16
- Method IYamlTypeInfoResolver.GetTypeInfo
- Method YamlMetadataServices.CreateCollectionInfo``2
- Method YamlMetadataServices.CreateDictionaryInfo``3
- Method YamlMetadataServices.CreateEnumInfo``1
- Method YamlMetadataServices.CreateNullableInfo``1
- Method YamlMetadataServices.CreateObjectInfo``1
- Method YamlMetadataServices.CreatePropertyInfo``1
- Method YamlSerializer.Deserialize
- Method YamlSerializer.Deserialize``1
- Method YamlSerializer.Serialize
- Method YamlSerializer.SerializeToNode
- Method YamlSerializer.SerializeToNode``1
- Method YamlSerializer.SerializeToUtf8Bytes
- Method YamlSerializer.SerializeToUtf8Bytes``1
- Method YamlSerializer.Serialize``1
- Constructor YamlSerializerOptions.YamlSerializerOptions
Constructors
public YamlSerializerOptions(YamlSerializerOptions options) #Creates a writable copy of options, including its resolver.
Parameters
- options OfficeIMO.Yaml.YamlSerializerOptions
Methods
public YamlTypeInfo GetTypeInfo(Type type) #Returns the metadata for type from the built-in types or YamlSerializerOptions.TypeInfoResolver, creating it once. It does not fall back to reflection.
Parameters
- type System.Type
Returns
YamlTypeInfoExceptions
NotSupportedException– No metadata source knows the type.
Inherited Methods
Properties
public static YamlSerializerOptions Default { get; } #Gets the shared default options, which are read-only. Serializer overloads without options use them.
public OfficeNamingPolicy? PropertyNamingPolicy { get; set; } #Gets or sets the policy that turns property names into mapping keys, or null (the default) to use the names as declared. OfficePropertyNameAttribute wins over it.
public OfficeIgnoreCondition DefaultIgnoreCondition { get; set; } #Gets or sets when properties are left out of written YAML: OfficeIgnoreCondition.Never (the default), OfficeIgnoreCondition.WhenWritingNull or OfficeIgnoreCondition.WhenWritingDefault.
public YamlReferenceHandling ReferenceHandling { get; set; } #Gets or sets how shared references and cycles are written and how aliases are read. Defaults to YamlReferenceHandling.None.
public bool CopyAliases { get; set; } #Gets or sets whether every alias read as object gets its own copy of its anchored node. Off by default: an alias read as object returns the dictionary, list or scalar already read for its anchor, as PyYAML does, so changing one changes every place that shares it. Typed values (properties, collections and dictionaries of a declared type) are read again from the anchored node for each alias either way; use YamlReferenceHandling.Preserve to map those aliases to one instance too. A shared value still counts every node it stands for against YamlReaderOptions.MaxAliasExpansion, because writing or walking it later visits them all.
public YamlReaderOptions? ReaderOptions { get; set; } #Gets or sets the reader settings for overloads that read text, streams or text readers: the schema, strictness and the limits, including YamlReaderOptions.MaxAliasExpansion for aliases. Null uses the defaults; use YamlReaderOptions.UntrustedDefaults for input from outside. Overloads that take a YamlReader use that reader's settings.
public YamlWriterOptions? WriterOptions { get; set; } #Gets or sets the layout of written YAML, or null for the YamlWriter defaults.
public IYamlTypeInfoResolver? TypeInfoResolver { get; set; } #Gets or sets where metadata comes from: a generated YamlSerializerContext, or null. With null, YamlSerializer overloads that allow reflection create metadata by reflection.
public bool IsReadOnly { get; } #Gets whether the options are read-only, which they become on first use.