Modifier

Partager via


XmlSchemaDatatype.ChangeType Method

Definition

Converts the value specified, whose type is one of the valid Common Language Runtime (CLR) representations of the XML schema type represented by the XmlSchemaDatatype, to another valid CLR representation of the same value.

Overloads

ChangeType(Object, Type)

Converts the value specified, whose type is one of the valid Common Language Runtime (CLR) representations of the XML schema type represented by the XmlSchemaDatatype, to the CLR type specified.

ChangeType(Object, Type, IXmlNamespaceResolver)

Converts the value specified, whose type is one of the valid Common Language Runtime (CLR) representations of the XML schema type represented by the XmlSchemaDatatype, to the CLR type specified using the IXmlNamespaceResolver if the XmlSchemaDatatype represents the xs:QName type or a type derived from it.

ChangeType(Object, Type)

Source:
XmlSchemaDataType.cs
Source:
XmlSchemaDataType.cs
Source:
XmlSchemaDataType.cs

Converts the value specified, whose type is one of the valid Common Language Runtime (CLR) representations of the XML schema type represented by the XmlSchemaDatatype, to the CLR type specified.

public:
 virtual System::Object ^ ChangeType(System::Object ^ value, Type ^ targetType);
public virtual object ChangeType (object value, Type targetType);
abstract member ChangeType : obj * Type -> obj
override this.ChangeType : obj * Type -> obj
Public Overridable Function ChangeType (value As Object, targetType As Type) As Object

Parameters

value
Object

The input value to convert to the specified type.

targetType
Type

The target type to convert the input value to.

Returns

The converted input value.

Exceptions

The Object or Type parameter is null.

The type represented by the XmlSchemaDatatype does not support a conversion from type of the value specified to the type specified.

Remarks

For more information about type support in the System.Xml classes and conversion of XML data types, see the Type Support in the System.Xml Classes topic.

Applies to

ChangeType(Object, Type, IXmlNamespaceResolver)

Source:
XmlSchemaDataType.cs
Source:
XmlSchemaDataType.cs
Source:
XmlSchemaDataType.cs

Converts the value specified, whose type is one of the valid Common Language Runtime (CLR) representations of the XML schema type represented by the XmlSchemaDatatype, to the CLR type specified using the IXmlNamespaceResolver if the XmlSchemaDatatype represents the xs:QName type or a type derived from it.

public:
 virtual System::Object ^ ChangeType(System::Object ^ value, Type ^ targetType, System::Xml::IXmlNamespaceResolver ^ namespaceResolver);
public virtual object ChangeType (object value, Type targetType, System.Xml.IXmlNamespaceResolver namespaceResolver);
abstract member ChangeType : obj * Type * System.Xml.IXmlNamespaceResolver -> obj
override this.ChangeType : obj * Type * System.Xml.IXmlNamespaceResolver -> obj
Public Overridable Function ChangeType (value As Object, targetType As Type, namespaceResolver As IXmlNamespaceResolver) As Object

Parameters

value
Object

The input value to convert to the specified type.

targetType
Type

The target type to convert the input value to.

namespaceResolver
IXmlNamespaceResolver

An IXmlNamespaceResolver used for resolving namespace prefixes. This is only of use if the XmlSchemaDatatype represents the xs:QName type or a type derived from it.

Returns

The converted input value.

Exceptions

The Object or Type parameter is null.

The type represented by the XmlSchemaDatatype does not support a conversion from type of the value specified to the type specified.

Remarks

For more information about type support in the System.Xml classes and conversion of XML data types, see the Type Support in the System.Xml Classes topic.

Applies to