StringExtensions.As Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
As<TValue>(String) |
Converts a string to a strongly typed value of the specified data type. |
As<TValue>(String, TValue) |
Converts a string to the specified data type and specifies a default value. |
As<TValue>(String)
Converts a string to a strongly typed value of the specified data type.
public static TValue As<TValue>(this string value);
static member As : string -> 'Value
<Extension()>
Public Function As(Of TValue) (value As String) As TValue
Type Parameters
- TValue
The data type to convert to.
Parameters
- value
- String
The value to convert.
Returns
The converted value.
Applies to
As<TValue>(String, TValue)
Converts a string to the specified data type and specifies a default value.
public static TValue As<TValue>(this string value, TValue defaultValue);
static member As : string * 'Value -> 'Value
<Extension()>
Public Function As(Of TValue) (value As String, defaultValue As TValue) As TValue
Type Parameters
- TValue
The data type to convert to.
Parameters
- value
- String
The value to convert.
- defaultValue
- TValue
The value to return if value
is null.
Returns
The converted value.