An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

stringenum

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)

Ecosystem
nuget.org
Latest Release
0.1.0
over 6 years ago
Versions
3
Downloads
126,598 total
Dependent Repos
1
Links
Registry nuget.org
Source Repository
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:nuget/stringenum
spec
License MIT
First Release about 126 years ago
Last Synced 9 days ago
Repository
Stars 18 on GitHub
Forks 5 on GitHub
Rankings on nuget.org
Overall Top 9.7%
Downloads Top 6.6%
Dependent repos Top 7.0%
Forks Top 7.3%