YamlSerializableAttribute Class
Declares a root type for a source-generated YamlSerializerContext.
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public sealed class YamlSerializableAttribute : YamlAttributeRemarks
Apply this attribute to a YamlSerializerContext-derived partial class once per root type that should have generated YAML metadata.
- Inheritance
YamlAttributeYamlSerializableAttribute
Constructors
| Name | Description |
|---|---|
| YamlSerializableAttribute(Type) | Initializes a new instance of the YamlSerializableAttribute class. |
YamlSerializableAttribute(Type)
YamlSerializableAttribute.csInitializes a new instance of the YamlSerializableAttribute class.
public YamlSerializableAttribute(Type type)Parameters
typeType- The root type that should have generated YAML metadata.
Exceptions
ArgumentNullExceptiontypeisnull.
Properties
| Name | Description |
|---|---|
| Type | Gets the root type that should have generated YAML metadata. |
| TypeInfoPropertyName | Gets or sets the generated YamlTypeInfo property name exposed on the context. |
TypeInfoPropertyName
YamlSerializableAttribute.csGets or sets the generated YamlTypeInfo property name exposed on the context.
public string? TypeInfoPropertyName { get; set; }