In This Article

IXmlSerializerProperty Interface

Defines the base requirements for a property that supports XML serialization.

public interface IXmlSerializerProperty

Properties

IsReadOnly

Indicates if the property is read-only.

bool IsReadOnly { get; }

Property Value

bool

IsXmlAttribute

Indicates if the property will be serialized as an XML attribute.

bool IsXmlAttribute { get; }

Property Value

bool

LocalName

The local name explicitly defined for the property.

string? LocalName { get; }

Property Value

string

PropertyName

The name of the property.

string PropertyName { get; }

Property Value

string

PropertyType

The value type of the property.

Type PropertyType { get; }

Property Value

Type

ResolvedLocalName

The resolved local name for the property.

string ResolvedLocalName { get; }

Property Value

string

SourceType

The type of the source object which defines the property.

Type SourceType { get; }

Property Value

Type

Methods

GetValue(object)

Gets the value of the property.

object? GetValue(object source)
Parameter Type Description
source object

The instance of the object whose property will be returned.

Returns

object

SetValue(object, object?)

Sets the value of the property.

void SetValue(object source, object? value)
Parameter Type Description
source object

The instance of the object whose property will be set.

value object

The value to assign to the property.

ShouldSerialize(object)

Returns if the property should be serialized.

bool ShouldSerialize(object source)
Parameter Type Description
source object

The source instance of the object that defines the property.

Returns

bool:

true if the property should be serialized; otherwise, false.

Extension Methods