Skip to main content

Definition

Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.Xml.Serialization Inheritance: System.Attribute

Syntax

Summary

Determines how a member that already holds a value is handled when it is deserialized. This class cannot be inherited.

Usage

Apply [XmlObjectCreationHandling] to a property or field to say whether the value it already holds is replaced or populated when it is read. The attribute takes precedence over XmlSerializerOptions.PreferredObjectCreationHandling for that member. It is the counterpart of [JsonObjectCreationHandling].
Apply it to a type to set the handling for every member of the type that can be populated. Populate on a member that can’t be populated throws an InvalidOperationException the first time the type is used. That covers an array, an immutable or frozen collection, a collection declared as a read-only interface such as IEnumerable<T>, a single value such as a string or a number, a value with a custom converter, mixed content, a polymorphic type, and a value type with no setter. On a type that is created through a constructor with parameters, or on a member of such a type, it throws a NotSupportedException. See Populate a collection that already holds a value.

Remarks

On a property or field, the attribute takes precedence over XmlSerializerOptions.PreferredObjectCreationHandling for that member. On a type, it applies to every member of the type that can be populated. XmlObjectCreationHandling.Populate on a member that cannot be populated throws an InvalidOperationException when the type is first used: an array, an immutable collection, a value with a custom converter, a polymorphic type, or a value type with no setter. On a type that is created through a constructor with parameters it throws a NotSupportedException.

Examples

Constructors

.ctor

Initializes a new instance of the XmlObjectCreationHandlingAttribute class.

Syntax

Parameters

.ctor Inherited

Inherited from System.Attribute

Syntax

.ctor Inherited

Inherited from object

Syntax

Properties

Handling

Gets the handling that applies to the member, or to the members of the type.

Syntax

Property Value

Type: CloudNimble.Text.Xml.Serialization.XmlObjectCreationHandling One of the enumeration values that specifies whether an existing value is replaced or populated.

TypeId Inherited Virtual

Inherited from System.Attribute

Syntax

Property Value

Type: object

Methods

Equals Override

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttribute Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute?

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetCustomAttributes Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: System.Attribute[]

GetHashCode Override

Inherited from System.Attribute

Syntax

Returns

Type: int

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

IsDefaultAttribute Inherited Virtual

Inherited from System.Attribute

Syntax

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

IsDefined Inherited

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

Match Inherited Virtual

Inherited from System.Attribute

Syntax

Parameters

Returns

Type: bool

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?