Enum Name To Display Name

private static Regex UpperCamelCaseRegex = new Regex(@"(?<!^)((?<!\d)\d|(?(?<=[A-Z])[A-Z](?=[a-z])|[A-Z]))", RegexOptions.Compiled);

public static string AsUpperCamelCaseName(this Enum e)
{
    return UpperCamelCaseRegex.Replace(e.ToString(), " $1");
}
Example:
foreach(HttpStatusCode c in Enum.GetValues(typeof(HttpStatusCode)))
{
    Console.WriteLine("Name:{0} - {1}", c, c.AsUpperCamelCaseName());
}

Description

Convert an CamelCase enum name to displayable string

Details

Double click on the code to select all.

 

;