public static void Main()
var parameter = "Name,Address";
var sync = ProfileSyncTypes.None;
sync = parameter.ToEnum<ProfileSyncTypes>();
Console.WriteLine("Sync {0}", sync);
public enum ProfileSyncTypes
public static class EnumParser
public static T ToEnum<T>(this string value)
return value.ToEnum<T>(true);
public static T ToEnum<T>(this string value, bool ignoreCase)
return (T) Enum.Parse(typeof(T), value, ignoreCase);