Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Convert string to Enum using C#

/// 09/14/2022 Mahesh Kumar Yadav. <br/>
/// <summary>
/// Convert string to enum
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="value"></param>
/// <returns></returns>
public static T ToEnum<T>(this string value)
{
    return (T)Enum.Parse(typeof(T), value, true);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Convert #string #Enum
ADD COMMENT
Topic
Name
1+7 =