Cast(T) Method

GWN Framework Contact Manager

ObjectExtensions..::..Cast<(Of <(<'T>)>)> Method

Casts the specified object to T. The isRequired parameter defaults to true and is not required.

Namespace:  Gwn.Common.Library.Extensions
Assembly:  Gwn.Common.Library (in Gwn.Common.Library.dll)

Syntax


public static T Cast<T>(
	Object objectToCast,
	bool isRequired
)

Type Parameters

T

Parameters

objectToCast
Type: Object
The object to cast.
isRequired
Type: Boolean
if set to true [is required].

Return Value

typeof(T). Returns null if invalid cast unless isRequired is true; if true an invalid cast will throw an argument not null exception