ExtensionMethod.NET Home of 841 C#, Visual Basic, F# and Javascript extension methods

Enum Name To Display Name

Convert an CamelCase enum name to displayable string


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");


foreach(HttpStatusCode c in Enum.GetValues(typeof(HttpStatusCode)))
    Console.WriteLine("Name:{0} - {1}", c, c.AsUpperCamelCaseName());

Author: AdamTha

Submitted on: 3 feb 2015

Language: C#

Type: System.Enum

Views: 5634