StringEnum (nuget): StringEnum is a base class for creating string-valued enums in .NET.  Features - Your StringEnum interface looks similar to a regular enum - Provides static Parse() and TryParse() methods and implicit cast to string. - Intellisense will suggest the enum name if the class is annotated with the xml comment `<completitionlist>`. (Works in both C# and VB)  Usage:  ///<completionlist cref="HexColor"/>  class HexColor : StringEnum<HexColor> {     public static readonly HexColor Blue = Create("#FF0000");     public static readonly HexColor Green = Create("#00FF00");     public static readonly HexColor Red = Create("#000FF"); }  // Static Parse Method HexColor.Parse("#FF0000") // => HexColor.Red HexColor.Parse("#ff0000", caseSensitive: false) // => HexColor.Red HexColor.Parse("invalid") // => throws InvalidOperationException  // Static TryParse method. HexColor.TryParse("#FF0000") // => HexColor.Red HexColor.TryParse("#ff0000", caseSensitive: false) // => HexColor.Red HexColor.TryParse("invalid") // => null  // Conversion from your `StringEnum` to `string` string myString1 = HexColor.Red.ToString(); // => "#FF0000" string myString2 = HexColor.Red; // => "#FF0000" (implicit cast)
Keywords: string|valued|enum|enumstring|stringenum