AsExtensions.As(TType) Method

Tungsten Suite

AsExtensionsAsTType Method

Use Generic syntax for the as operator.

Namespace:  W
Assembly:  Tungsten.As (in Tungsten.As.dll) Version: 2.0.1
Syntax
C#
public static TType As<TType>(
	this Object this
)
where TType : class

Parameters

this
Type: SystemObject
The item to convert to type TType

Type Parameters

TType
The type to convert the item reference to.

Return Value

Type: TType
Null if @this cannot be referenced as TType. Otherwise, the item as TType

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).
Examples
expression as type
becomes
expression.As<type>()
See Also