Class
ComponentXmlSerializer

Provides XML serialization functionality for components using the same rules as Visual Studio Code DOM serialization.

Definition

Namespace:Telerik.WinControls.XmlSerialization

Assembly:Telerik.WinControls.dll

Syntax:

cs-api-definition
public class ComponentXmlSerializer

Inheritance: objectComponentXmlSerializer

Derived Classes: GridViewDesignTimeSerializerDockXmlSerializerBaseFloatingWindowsXmlNonResolvingSerializerGridViewLayoutSerializerLayoutControlXmlSerializerVirtualKeyboardXmlSerializerControlXmlSerializerTaskBoardXmlSerializer

Constructors

ComponentXmlSerializer()

Initializes a new instance of the ComponentXmlSerializer class with default serialization settings.

Declaration

cs-api-definition
public ComponentXmlSerializer()

ComponentXmlSerializer(ComponentXmlSerializationInfo)

Initializes a new instance of the ComponentXmlSerializer class with extended property serialization information.

Declaration

cs-api-definition
public ComponentXmlSerializer(ComponentXmlSerializationInfo componentSerializationInfo)

Parameters

componentSerializationInfo

ComponentXmlSerializationInfo

Extended property serialization information for customizing serialization behavior.

ComponentXmlSerializer(IDictionary, ComponentXmlSerializationInfo)

Initializes a new instance of the ComponentXmlSerializer class with custom type mapping and serialization information.

Declaration

cs-api-definition
public ComponentXmlSerializer(IDictionary typeMap, ComponentXmlSerializationInfo componentSerializationInfo)

Parameters

typeMap

IDictionary

Dictionary mapping type full names to XML element names for custom serialization.

componentSerializationInfo

ComponentXmlSerializationInfo

Extended property serialization information for customizing serialization behavior.

Properties

InstanceFactory

Declaration

cs-api-definition
public virtual InstanceFactory InstanceFactory { get; set; }

Property Value

InstanceFactory

PropertiesProvider

Gets or sets the properties provider used for custom property handling during serialization.

Declaration

cs-api-definition
public IPropertiesProvider PropertiesProvider { get; set; }

Property Value

IPropertiesProvider

The properties provider instance.

ResolveTypesOnlyInTelerikAssemblies

Gets or sets a value indicating whether the serializer will search only Telerik assemblies for type resolution.

Declaration

cs-api-definition
public bool ResolveTypesOnlyInTelerikAssemblies { get; set; }

Property Value

bool

true to search only Telerik assemblies; false to search all domain assemblies.

RootSerializationObject

Gets the root object being serialized or deserialized.

Declaration

cs-api-definition
public object RootSerializationObject { get; }

Property Value

object

The root serialization object.

Methods

DisposeObject(IDisposable)

Declaration

cs-api-definition
protected virtual void DisposeObject(IDisposable toBeDisposed)

Parameters

toBeDisposed

IDisposable

GetCollectionElementOverride(IEnumerable, object, PropertyDescriptor)

Declaration

cs-api-definition
protected virtual IEnumerable GetCollectionElementOverride(IEnumerable list, object owner, PropertyDescriptor property)

Parameters

list

IEnumerable

owner

object

property

PropertyDescriptor

Returns

IEnumerable

GetElementNameByType(Type)

Declaration

cs-api-definition
protected virtual string GetElementNameByType(Type elementType)

Parameters

elementType

Type

Returns

string

GetPropertyValue(PropertyDescriptor, object)

Declaration

cs-api-definition
protected virtual object GetPropertyValue(PropertyDescriptor property, object propertyOwner)

Parameters

property

PropertyDescriptor

propertyOwner

object

Returns

object

InitializeRead()

Declaration

cs-api-definition
protected virtual void InitializeRead()

InitializeWrite()

Declaration

cs-api-definition
protected virtual void InitializeWrite()

MatchExistingItem(XmlReader, IList, object, PropertyDescriptor, string, string, IList, ref int)

Declaration

cs-api-definition
protected virtual object MatchExistingItem(XmlReader reader, IList toRead, object parent, PropertyDescriptor parentProperty, string propertyToMatch, string uniquePropertyValue, IList existingInstancesToMatch, ref int foundAtIndex)

Parameters

reader

XmlReader

toRead

IList

parent

object

parentProperty

PropertyDescriptor

propertyToMatch

string

uniquePropertyValue

string

existingInstancesToMatch

IList

foundAtIndex

int

Returns

object

MatchObjectElement(XmlReader, object, PropertyDescriptor, IList, string, IList, out int)

Matches the instance of the element by an attribute value and then deserializes its properties. If the instance is not found in existingInstancesToMatch, new instance of type instanceType will be created and added to existingInstancesToMatch list.

Declaration

cs-api-definition
protected virtual object MatchObjectElement(XmlReader reader, object parent, PropertyDescriptor parentProperty, IList toRead, string propertyToMatch, IList existingInstancesToMatch, out int foundAtIndex)

Parameters

reader

XmlReader

parent

object

parentProperty

PropertyDescriptor

toRead

IList

propertyToMatch

string

existingInstancesToMatch

IList

the list with existing instances

foundAtIndex

int

index of the element if found in existingInstanceToMatch

Returns

object

ProcessListOverride(XmlReader, object, PropertyDescriptor, IList)

Override to provide custom processing of collection being deserialized

Declaration

cs-api-definition
protected virtual bool ProcessListOverride(XmlReader reader, object listOwner, PropertyDescriptor ownerProperty, IList list)

Parameters

reader

XmlReader

listOwner

object

ownerProperty

PropertyDescriptor

list

IList

Returns

bool

True if the list does not require further processing by the deserializer, False to use the default deserialization

ProcessProperty(PropertyDescriptor)

Declaration

cs-api-definition
protected virtual bool ProcessProperty(PropertyDescriptor property)

Parameters

property

PropertyDescriptor

Returns

bool

ProcessReaderAttribute(XmlReader, object, object, PropertyDescriptor)

Reads a property of an object and subobject the reader is currently positioned on.

Declaration

cs-api-definition
protected virtual bool ProcessReaderAttribute(XmlReader reader, object parentObject, object toRead, PropertyDescriptor property)

Parameters

reader

XmlReader

Xml reader instance, positioned on the element to read.

parentObject

object

The parent object instance, null if there is no parent object information

toRead

object

The object instance to be processed

property

PropertyDescriptor

The property that is being processed. Extracted from reader.Name

Returns

bool

A value indicating whether the attribute has been processed. If [true] the parent class will not process current property/attribute.

ProcessTypeOverride(Type, XmlReader, PropertyDescriptor, object)

Declaration

cs-api-definition
protected virtual bool ProcessTypeOverride(Type type, XmlReader reader, PropertyDescriptor property, object toRead)

Parameters

type

Type

reader

XmlReader

property

PropertyDescriptor

toRead

object

Returns

bool

ReadCollectionElement(XmlReader, IList)

Reads a collection element from the XML reader and populates the specified list.

Declaration

cs-api-definition
public void ReadCollectionElement(XmlReader reader, IList toRead)

Parameters

reader

XmlReader

The XML reader positioned at a collection element.

toRead

IList

The list to populate with deserialized items.

ReadCollectionElement(XmlReader, object, IList)

Reads a collection element from the XML reader and populates the specified list with an owner context.

Declaration

cs-api-definition
public void ReadCollectionElement(XmlReader reader, object collectionOwner, IList toRead)

Parameters

reader

XmlReader

The XML reader positioned at a collection element.

collectionOwner

object

The object that owns the collection property being deserialized.

toRead

IList

The list to populate with deserialized items.

ReadCollectionElement(XmlReader, object, IList, bool)

Reads a collection element from the XML reader and populates the specified list with disposal options.

Declaration

cs-api-definition
public void ReadCollectionElement(XmlReader reader, object collectionOwner, IList toRead, bool disposeObjects)

Parameters

reader

XmlReader

The XML reader positioned at a collection element.

collectionOwner

object

The object that owns the collection property being deserialized.

toRead

IList

The list to populate with deserialized items.

disposeObjects

bool

Whether to dispose objects during deserialization.

ReadDictionaryElement(XmlReader, object, IDictionary)

Declaration

cs-api-definition
protected void ReadDictionaryElement(XmlReader reader, object dictionaryOwner, IDictionary toRead)

Parameters

reader

XmlReader

dictionaryOwner

object

toRead

IDictionary

ReadElementInObject(XmlReader, PropertyDescriptor, object)

Deserializes a specified property of an object

Declaration

cs-api-definition
protected virtual void ReadElementInObject(XmlReader reader, PropertyDescriptor property, object toRead)

Parameters

reader

XmlReader

Xml reader, positioned on the element corresponding to the property to deserialize

property

PropertyDescriptor

Property descriptor of the property to deserialize

toRead

object

Object that owns the property to deserialize

ReadMergeCollection(XmlReader, object, PropertyDescriptor, IList, string)

Reads the collection items if reader is positioned on an element that is a collection.

Declaration

cs-api-definition
protected void ReadMergeCollection(XmlReader reader, object parent, PropertyDescriptor parentProperty, IList toRead, string uniquePropertyName)

Parameters

reader

XmlReader

parent

object

parentProperty

PropertyDescriptor

toRead

IList

uniquePropertyName

string

property used to match objects in collection

ReadMergeCollection(XmlReader, object, PropertyDescriptor, IList, string, bool)

Reads the collection items if reader is positioned on an element that is a collection.

Declaration

cs-api-definition
protected void ReadMergeCollection(XmlReader reader, object parent, PropertyDescriptor parentProperty, IList toRead, string uniquePropertyName, bool disposeObjects)

Parameters

reader

XmlReader

parent

object

parentProperty

PropertyDescriptor

toRead

IList

uniquePropertyName

string

property used to match objects in collection

disposeObjects

bool

ReadMergeCollection(XmlReader, object, PropertyDescriptor, IList, string, bool, bool)

if Reader is positioned at an element that is a collection, reads the collection items.

Declaration

cs-api-definition
protected void ReadMergeCollection(XmlReader reader, object parent, PropertyDescriptor parentProperty, IList toRead, string uniquePropertyName, bool preserveNotSerializedExistingElements, bool disposeObjects)

Parameters

reader

XmlReader

parent

object

parentProperty

PropertyDescriptor

toRead

IList

uniquePropertyName

string

property used to match objects in collection

preserveNotSerializedExistingElements

bool

States whether the list specified by toRead should not be cleared before reading

disposeObjects

bool

ReadObjectElement(XmlReader, object)

Reads properties of an object and subobject the reader is currently positioned on.

Declaration

cs-api-definition
public void ReadObjectElement(XmlReader reader, object toRead)

Parameters

reader

XmlReader

Xml reader instance, positioned on the element to read.

toRead

object

object instance to be processed

ReadObjectElement(XmlReader, object, object)

Reads properties of an object and subobject the reader is currently positioned on.

Declaration

cs-api-definition
public void ReadObjectElement(XmlReader reader, object parentObject, object toRead)

Parameters

reader

XmlReader

Xml reader instance, positioned on the element to read.

parentObject

object

parent object instance, null if there is no parent object information

toRead

object

object instance to be processed

ReadObjectElementOverride(XmlReader, object)

Override to provide alternative deserialization of objects.

Declaration

cs-api-definition
protected virtual bool ReadObjectElementOverride(XmlReader reader, object toRead)

Parameters

reader

XmlReader

toRead

object

Returns

bool

value indicating whether the object should be processed any further by serializer

SetPropertyValue(PropertyDescriptor, object, object)

Declaration

cs-api-definition
protected virtual void SetPropertyValue(PropertyDescriptor property, object propertyOwner, object value)

Parameters

property

PropertyDescriptor

propertyOwner

object

value

object

ShouldSerializeValue(object, PropertyDescriptor, PropertySerializationMetadata)

Provides logic to determine whether property value should be serialized.

Declaration

cs-api-definition
protected virtual bool ShouldSerializeValue(object component, PropertyDescriptor property, PropertySerializationMetadata overwriteMetadata)

Parameters

component

object

property

PropertyDescriptor

property to serialize

overwriteMetadata

PropertySerializationMetadata

collection of extra serialization attributes for the property, corresponding to ComponentSerializationInfo

Returns

bool

value indicating whether property value should be serialized

Remarks

ShouldSerialize value resolution is as follows:

WriteCollectionElement(XmlWriter, IEnumerable, object, PropertyDescriptor)

Declaration

cs-api-definition
protected virtual void WriteCollectionElement(XmlWriter writer, IEnumerable list, object listOwner, PropertyDescriptor property)

Parameters

writer

XmlWriter

list

IEnumerable

listOwner

object

property

PropertyDescriptor

WriteCollectionElement(XmlWriter, IEnumerable, string)

Declaration

cs-api-definition
public void WriteCollectionElement(XmlWriter writer, IEnumerable list, string collectionName)

Parameters

writer

XmlWriter

list

IEnumerable

collectionName

string

WriteDictionaryElement(XmlWriter, IDictionary, object, PropertyDescriptor)

Declaration

cs-api-definition
protected void WriteDictionaryElement(XmlWriter writer, IDictionary toWrite, object listOwner, PropertyDescriptor property)

Parameters

writer

XmlWriter

toWrite

IDictionary

listOwner

object

property

PropertyDescriptor

WriteObjectElement(XmlWriter, object)

Serializes the given object using the specified XmlWriter.

Declaration

cs-api-definition
public virtual void WriteObjectElement(XmlWriter writer, object toWrite)

Parameters

writer

XmlWriter

toWrite

object

WritePropertyOverride(XmlWriter, PropertyDescriptor, object, DesignerSerializationVisibility)

Declaration

cs-api-definition
protected virtual bool WritePropertyOverride(XmlWriter writer, PropertyDescriptor property, object propertyValue, DesignerSerializationVisibility serializationVisibility)

Parameters

writer

XmlWriter

property

PropertyDescriptor

propertyValue

object

serializationVisibility

DesignerSerializationVisibility

Returns

bool

WriteTypeAttribute(XmlWriter, Type, object, DesignerSerializationVisibility)

Declaration

cs-api-definition
protected virtual void WriteTypeAttribute(XmlWriter writer, Type expectedType, object toWrite, DesignerSerializationVisibility serializationVisibility)

Parameters

writer

XmlWriter

expectedType

Type

toWrite

object

serializationVisibility

DesignerSerializationVisibility

In this article
DefinitionConstructorsComponentXmlSerializer()ComponentXmlSerializer(ComponentXmlSerializationInfo)ComponentXmlSerializer(IDictionary, ComponentXmlSerializationInfo)PropertiesInstanceFactoryPropertiesProviderResolveTypesOnlyInTelerikAssembliesRootSerializationObjectMethodsDisposeObject(IDisposable)GetCollectionElementOverride(IEnumerable, object, PropertyDescriptor)GetElementNameByType(Type)GetPropertyValue(PropertyDescriptor, object)InitializeRead()InitializeWrite()MatchExistingItem(XmlReader, IList, object, PropertyDescriptor, string, string, IList, ref int)MatchObjectElement(XmlReader, object, PropertyDescriptor, IList, string, IList, out int)ProcessListOverride(XmlReader, object, PropertyDescriptor, IList)ProcessProperty(PropertyDescriptor)ProcessReaderAttribute(XmlReader, object, object, PropertyDescriptor)ProcessTypeOverride(Type, XmlReader, PropertyDescriptor, object)ReadCollectionElement(XmlReader, IList)ReadCollectionElement(XmlReader, object, IList)ReadCollectionElement(XmlReader, object, IList, bool)ReadDictionaryElement(XmlReader, object, IDictionary)ReadElementInObject(XmlReader, PropertyDescriptor, object)ReadMergeCollection(XmlReader, object, PropertyDescriptor, IList, string)ReadMergeCollection(XmlReader, object, PropertyDescriptor, IList, string, bool)ReadMergeCollection(XmlReader, object, PropertyDescriptor, IList, string, bool, bool)ReadObjectElement(XmlReader, object)ReadObjectElement(XmlReader, object, object)ReadObjectElementOverride(XmlReader, object)SetPropertyValue(PropertyDescriptor, object, object)ShouldSerializeValue(object, PropertyDescriptor, PropertySerializationMetadata)WriteCollectionElement(XmlWriter, IEnumerable, object, PropertyDescriptor)WriteCollectionElement(XmlWriter, IEnumerable, string)WriteDictionaryElement(XmlWriter, IDictionary, object, PropertyDescriptor)WriteObjectElement(XmlWriter, object)WritePropertyOverride(XmlWriter, PropertyDescriptor, object, DesignerSerializationVisibility)WriteTypeAttribute(XmlWriter, Type, object, DesignerSerializationVisibility)
Not finding the help you need?
Contact Support