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.

C#
public virtual object ValueAs(Type returnType);

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

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.

C#
public abstract object ValueAs(Type returnType, System.Xml.IXmlNamespaceResolver? nsResolver);
C#
public abstract object ValueAs(Type returnType, System.Xml.IXmlNamespaceResolver nsResolver);

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

.NET 10 a ďalšie verzie
Produkt Verzie
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1