Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# class where T : enum

public T GetEnumFromString<T>(string value) where T : struct, IConvertible
{
   if (!typeof(T).IsEnum) 
   {
      throw new ArgumentException("T must be an enumerated type");
   }

   //...
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #class #T #enum
ADD COMMENT
Topic
Name
8+1 =