Click or drag to resize

ValueExtensionsAsT Method (Object, T)

A helper method to explicitly cast the value streamed back via Bolt to a local type, with default fallback value.

Namespace:  Neo4j.Driver
Assembly:  Neo4j.Driver (in Neo4j.Driver.dll) Version: 4.1.0
Syntax
public static T As<T>(
	this Object value,
	T defaultValue
)

Parameters

value
Type: SystemObject
The value that streamed back via Bolt protocol, e.g.Properties.
defaultValue
Type: T
Returns this value if the the value is null

Type Parameters

T
Supports for the following types (or nullable version of the following types if applies): Int16, Int32, Int64, Single, Double, SByte, UInt16, UInt32, UInt64, Byte, Char, Boolean, String, ListT, INode, IRelationship, IPath. Undefined support for other types that are not listed above. No support for user-defined types, e.g. Person, Movie.

Return Value

Type: T
The value of specified return type.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Object. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
Throws InvalidCastException if the specified cast is not possible.
See Also