Method As
As<T>(object, T)
A helper method to explicitly cast the value streamed back via Bolt to a local type, with default fallback value.
public static T As<T>(this object value, T defaultValue)
Parameters
value
objectThe value that streamed back via Bolt protocol, e.g.Properties.
defaultValue
TReturns this value if the the value is null
Returns
- T
The value of specified return type.
Type Parameters
T
Supports for the following types (or nullable version of the following types if applies): short, int, long, float, double, sbyte, ushort, uint, ulong, byte, char, bool, string, List<T>, INode, IRelationship, IPath. Undefined support for other types that are not listed above. No support for user-defined types, e.g. Person, Movie.
Remarks
Throws InvalidCastException if the specified cast is not possible.
As<T>(object)
A helper method to explicitly cast the value streamed back via Bolt to a local type.
public static T As<T>(this object value)
Parameters
value
objectThe value that streamed back via Bolt protocol, e.g.Properties.
Returns
- T
The value of specified return type.
Type Parameters
T
Supports for the following types (or nullable version of the following types if applies): short, int, long, float, double, sbyte, ushort, uint, ulong, byte, char, bool, string, List<T>, INode, IRelationship, IPath. Undefined support for other types that are not listed above. No support for user-defined types, e.g. Person, Movie.
Remarks
Throws InvalidCastException if the specified cast is not possible.