Converts a string to its enum representation.
Namespace: CTCT.UtilAssembly: CTCT (in CTCT.dll) Version: 2.0.0.0 (2.0.0.0)
public static T ToEnum<T>(
this string s
)
where T : struct, new(), IConvertible
public static T ToEnum<T>(
this string s
)
where T : struct, new(), IConvertible
<ExtensionAttribute> _
Public Shared Function ToEnum(Of T As {Structure, New, IConvertible}) ( _
s As String _
) As T
<ExtensionAttribute> _
Public Shared Function ToEnum(Of T As {Structure, New, IConvertible}) ( _
s As String _
) As T
public:
[ExtensionAttribute]
generic<typename T>
where T : value class, gcnew(), IConvertible
static T ToEnum(
String^ s
)
public:
[ExtensionAttribute]
generic<typename T>
where T : value class, gcnew(), IConvertible
static T ToEnum(
String^ s
)
static member ToEnum :
s : string -> 'T when 'T : struct, new() and IConvertible
static member ToEnum :
s : string -> 'T when 'T : struct, new() and IConvertible
Parameters
- s
- Type: System.String
String to convert.
- T
- Enum type.
Return Value
Returns the enum 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
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).