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


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

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.

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
© 2016 Microsoft