Definition
Assembly: CloudNimble.XmlEssentials.dll Namespace: CloudNimble.Text.Xml.SerializationSyntax
Summary
Provides XML serialization-related metadata about a property or field. This class cannot be inherited.Usage
AnXmlPropertyInfo describes how one member of an object is mapped: its XML name, whether it’s an attribute, an element, or the text of its parent, whether it’s required, and the type info of its value. You read these objects from XmlTypeInfo.Properties. You don’t create them.
Name is the XML name, after attributes and naming policies: the Lines property appears as Line because of [XmlElement("Line")]. Order is the explicit order of the member among its siblings, or -1 when it has none.
The list is filled for a type that the serializer maps member by member, whether the type info comes from the reflection resolver or from a source-generated context in the default mode or in Metadata mode. It’s empty for type info from a context in Serialization mode. The class is read-only. Unlike JsonPropertyInfo in System.Text.Json, it can’t be used to change a contract.
View the complete sample on GitHub
Constructors
.ctor Inherited
Inherited from
objectSyntax
Properties
IsAttribute
Gets a value that indicates whether the member is serialized as an XML attribute.Syntax
Property Value
Type:bool
true if the member is serialized as an XML attribute; otherwise, false.
IsNillable
Gets a value that indicates whether the member is nillable.Syntax
Property Value
Type:bool
true if the member is nillable; otherwise, false.
Remarks
A member is nillable when its type is a reference type, a [Nullable1](https://learn.microsoft.com/dotnet/api/system.nullable-1), or a collection, or when [XmlElementAttribute.IsNullable](/xmlessentials/api-reference/CloudNimble/Text/Xml/Serialization/XmlElementAttribute#isnullable) is [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). Whether a [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) value is written depends on the ignore condition of the member. When it is written, it is an element marked xsi:nil=“true”`.
IsRequired
Gets a value that indicates whether the member must be present on deserialization.Syntax
Property Value
Type:bool
true if the member must be present on deserialization; otherwise, false.
IsText
Gets a value that indicates whether the member is serialized as the text content of the element for its containing type.Syntax
Property Value
Type:bool
true if the member is serialized as text content; otherwise, false.
Name
Gets the XML name of the member.Syntax
Property Value
Type:CloudNimble.Text.Xml.XmlName
The name of the element or attribute that the member is serialized as.
Order
Gets the serialization order of the member among the members of its containing type.Syntax
Property Value
Type:int
The order of the member, or -1 if no order is set.
PropertyType
Gets the metadata for the type of the member.Syntax
Property Value
Type:CloudNimble.Text.Xml.Serialization.XmlTypeInfo
The serialization metadata for the type of the member.
Methods
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
Related APIs
- CloudNimble.Text.Xml.Serialization.XmlTypeInfo
- CloudNimble.Text.Xml.Serialization.XmlAttributeAttribute
- CloudNimble.Text.Xml.Serialization.XmlElementAttribute
- CloudNimble.Text.Xml.Serialization.XmlTextAttribute
- CloudNimble.Text.Xml.Serialization.XmlRequiredAttribute
- CloudNimble.Text.Xml.Serialization.XmlPropertyOrderAttribute
- CloudNimble.Text.Xml.XmlName