ValueAs Method (Type)
Collapse the table of content
Expand the table of content

XPathItem.ValueAs Method (Type)

 

Returns the item's value as the specified type.

Namespace:   System.Xml.XPath
Assembly:  System.Xml (in System.Xml.dll)

public virtual object ValueAs(
	Type returnType
)

Parameters

returnType
Type: System.Type

The type to return the item value as.

Return Value

Type: System.Object

The value of the item as the type requested.

Exception Condition
FormatException

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

InvalidCastException

The attempted cast is not valid.

OverflowException

The attempted cast resulted in an overflow.

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.

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft