Share via


StringExtensions.As<TValue> Method (String)

Converts a string to a strongly typed value of the specified data type.

Namespace:  System.Web.WebPages
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function As(Of TValue) ( _
    value As String _
) As TValue
'Usage
Dim value As String 
Dim returnValue As TValue

returnValue = value.As()
public static TValue As<TValue>(
    this string value
)
[ExtensionAttribute]
public:
generic<typename TValue>
static TValue As(
    String^ value
)
static member As : 
        value:string -> 'TValue 
JScript does not support generic types and methods.

Type Parameters

  • TValue
    The data type to convert to.

Parameters

Return Value

Type: TValue
The converted value.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.111) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.111).

Remarks

For more information about how to use this method, see the As() topic.

See Also

Reference

StringExtensions Class

As Overload

System.Web.WebPages Namespace