New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

StringEnum

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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)

Source
nugetNuGet
Version
0.1.0
Version published
Maintainers
1
Created
The README file is missing

Keywords

string

FAQs

Package last updated on 23 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts