YamlObjectCreationHandlingAttribute class

Determines how deserialization will handle object creation for fields or properties.

Namespace: System.Text.Yaml.Serialization ยท Assembly: Styml.dll

public sealed class YamlObjectCreationHandlingAttribute : YamlAttribute

Inheritance: object โ†’ Attribute โ†’ YamlAttribute โ†’ YamlObjectCreationHandlingAttribute

Determines how deserialization will handle object creation for fields or properties.

RemarksLink to this heading

When placed on a field or property, indicates if member will replaced or populated. When default resolvers are used this will be mapped to YamlPropertyInfo.ObjectCreationHandling. When placed on a type with YamlObjectCreationHandling.Populate indicates that all members that support population will be populated. When default resolvers are used this will be mapped to YamlTypeInfo.PreferredPropertyObjectCreationHandling. Note that the attribute corresponds only to the preferred values of creation handling for properties when placed on a type. For example when YamlObjectCreationHandlingAttribute with YamlObjectCreationHandling.Populate is placed on a class and property is not capable of being populated, it will be replaced. That may be true if i.e. value type doesn't have a setter or property is of type IEnumerable<T>. Only the property type is taken into consideration. For example if property is of type IEnumerable<T> has runtime value of type List<T> it will not be populated because IEnumerable<T> is not capable of populating. Value types require a setter to support population; in such cases deserialization will use a copy of the property value which will get assigned back to the setter once finished.

ConstructorsLink to this heading

Initializes a new instance of YamlObjectCreationHandlingAttribute.

public YamlObjectCreationHandlingAttribute(YamlObjectCreationHandling handling);

Parameters

  • handling: The handling to apply to the current member.

PropertiesLink to this heading

HandlingLink to this heading

Indicates what configuration should be used when deserializing members.

public YamlObjectCreationHandling Handling { get; }

Generated from the XML documentation of the libraryBuilt with Douze

Esc to close