Return to Snippet

Revision: 38525
at January 4, 2011 21:21 by samwa


Initial Code
public static T StringToEnum<T>(string name)
{
  return (T)Enum.Parse(typeof(T), name);
}

Initial URL
http://www.switchonthecode.com/tutorials/csharp-snippet-tutorial-how-to-get-an-enum-from-a-string

Initial Description


Initial Title
Convert string to enum

Initial Tags
c#

Initial Language
C#