Modifica

Condividi tramite


XPathItem.ValueAs Method

Definition

Returns the item's value as the specified type.

Overloads

ValueAs(Type)

Returns the item's value as the specified type.

ValueAs(Type, IXmlNamespaceResolver)

When overridden in a derived class, returns the item's value as the type specified using the IXmlNamespaceResolver object specified to resolve namespace prefixes.

ValueAs(Type)

Source:
XPathItem.cs
Source:
XPathItem.cs
Source:
XPathItem.cs

Returns the item's value as the specified type.

public:
 virtual System::Object ^ ValueAs(Type ^ returnType);
public virtual object ValueAs (Type returnType);
abstract member ValueAs : Type -> obj
override this.ValueAs : Type -> obj
Public Overridable Function ValueAs (returnType As Type) As Object

Parameters

returnType
Type

The type to return the item value as.

Returns

The value of the item as the type requested.

Exceptions

The item's value is not in the correct format for the target type.

The attempted cast is not valid.

The attempted cast resulted in an overflow.

Remarks

When overridden in a derived class, the ValueAs method attempts to convert the value of the item to the .NET Framework 2.0 type specified.

See also

Applies to

ValueAs(Type, IXmlNamespaceResolver)

Source:
XPathItem.cs
Source:
XPathItem.cs
Source:
XPathItem.cs

When overridden in a derived class, returns the item's value as the type specified using the IXmlNamespaceResolver object specified to resolve namespace prefixes.

public:
 abstract System::Object ^ ValueAs(Type ^ returnType, System::Xml::IXmlNamespaceResolver ^ nsResolver);
public abstract object ValueAs (Type returnType, System.Xml.IXmlNamespaceResolver? nsResolver);
public abstract object ValueAs (Type returnType, System.Xml.IXmlNamespaceResolver nsResolver);
abstract member ValueAs : Type * System.Xml.IXmlNamespaceResolver -> obj
Public MustOverride Function ValueAs (returnType As Type, nsResolver As IXmlNamespaceResolver) As Object

Parameters

returnType
Type

The type to return the item's value as.

nsResolver
IXmlNamespaceResolver

The IXmlNamespaceResolver object used to resolve namespace prefixes.

Returns

The value of the item as the type requested.

Exceptions

The item's value is not in the correct format for the target type.

The attempted cast is not valid.

The attempted cast resulted in an overflow.

Remarks

When overridden in a derived class, the ValueAs method attempts to convert the value of the item to the .NET Framework 2.0 type specified.

The IXmlNamespaceResolver object is used to resolve namespace prefixes related to type conversions. For example, when converting an xs:QName to an xs:string.

For more information about type support in the System.Xml namespace, see Type Support in the System.Xml Classes.

See also

Applies to