ExtensionMethod.NET Home of 817 C#, Visual Basic, F# and Javascript extension methods

As

A wrapper for DirectCast function.

Source

''' <summary>
''' A wrapper for DirectCast function.
''' </summary>
Public Function [As](Of TResult)(ByVal value As Object) As TResult
    Return DirectCast(value, TResult)
End Function

Example

Dim x As Object = "String"
Dim s = x.As(Of String)

Author: Shimmy Weitzhandler

Submitted on: 12 jul 2010

Language: VB

Type: System.Object

Views: 2794