Click or drag to resize

ExtensionsCastOrDefaultT Method (Object, T)

Attempts to cast an object to a given type, and returning a default value if not successful

Namespace:  Couchbase.Lite.Util
Assembly:  Couchbase.Lite (in Couchbase.Lite.dll) Version: 2.0.0-b0125
Syntax
C#
public static T CastOrDefault<T>(
	Object obj,
	T defaultVal
)

Parameters

obj
Type: SystemObject
The object to cast
defaultVal
Type: T
The default value to use on failure

Type Parameters

T
The type to cast the object to

Return Value

Type: T
The cast object, or defaultVal if not successful
See Also