From df57ded07265c1c7b30fbe182be95580d745f4e1 Mon Sep 17 00:00:00 2001 From: Milan Djurdjevic Date: Tue, 13 Feb 2024 22:14:17 +0100 Subject: [PATCH] Update README.md --- README.md | 18 +++++------ {src/Strinum => img}/icon.png | Bin src/Strinum/README.md | 55 ---------------------------------- src/Strinum/Strinum.csproj | 4 +-- 4 files changed, 11 insertions(+), 66 deletions(-) rename {src/Strinum => img}/icon.png (100%) delete mode 100644 src/Strinum/README.md diff --git a/README.md b/README.md index c49dd0d..d0e622e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ -# Strinum - -## Fast and easy conversion between enums and strings [![latest version](https://img.shields.io/nuget/v/strinum)](https://www.nuget.org/packages/strinum) +# Strinum [![latest version](https://img.shields.io/nuget/v/strinum)](https://www.nuget.org/packages/strinum) +### Fast and easy enum conversion to strings Powerful source code generator designed to enhance your development workflow by automating the generation of stringification extension methods for enum types. This "tool" efficiently scans your source code, identifies enum types, and generates extension methods that facilitate the conversion of enum members to their corresponding string representations. ## Features @@ -11,7 +10,8 @@ Powerful source code generator designed to enhance your development workflow by ## Usage -The `Stringify()` extension method is generated for each enum type in your source code. If you call it on an enum member, it will return the member represented as a string. +The source generator will scan the source code for enum types and generate a `Stringify()` extension method that will +return the name of the enum member as a string. ```csharp public enum Number @@ -26,11 +26,10 @@ public enum Number Console.WriteLine(Number.Three.Stringify()); // Output: -// One -// Two -// Three +// Number 1 +// Number 2 +// Number 3 ``` - ### Customizing outputs Sometimes you want to change the output of a stringified enum value. To do that, you can use `StringifyAttribute` to override the default enum string value. @@ -83,6 +82,7 @@ Console.WriteLine(Number.Five.Stringify()); - 1 ns: 1 Nanosecond (0.000000001 sec) ### Device + - Chip: Apple M1 Pro - Memory: 16 GB -- OS: Sonoma 14.1.2 +- OS: Sonoma 14.1.2 \ No newline at end of file diff --git a/src/Strinum/icon.png b/img/icon.png similarity index 100% rename from src/Strinum/icon.png rename to img/icon.png diff --git a/src/Strinum/README.md b/src/Strinum/README.md deleted file mode 100644 index aae983d..0000000 --- a/src/Strinum/README.md +++ /dev/null @@ -1,55 +0,0 @@ -## About - -Versatile source code tool designed to automate the generation of stringification extension methods for enum types. By intelligently scanning your source code, this generator identifies enum types and creates streamlined methods for converting enum members to human-readable string representations. Improve code readability, simplify debugging, and boost productivity with EnumStringifyGenerator – the essential companion for enum handling in your projects. - -## Usage - -The `Stringify()` extension method is generated for each enum type in your source code. If you call it on an enum member, it will return the member represented as a string. - -```csharp -public enum Number -{ - One, - Two, - Three -} - - Console.WriteLine(Number.One.Stringify()); - Console.WriteLine(Number.Two.Stringify()); - Console.WriteLine(Number.Three.Stringify()); - -// Output: -// One -// Two -// Three -``` - -### Customizing outputs - -Sometimes you want to change the output of a stringified enum value. To do that, you can use `StringifyAttribute` to override the default enum string value. - -```csharp -using Strinum; - -public enum Number -{ - [Stringify("NumberOne")] One, - [Stringify("number_two")] Two, - [Stringify("number-three")] Three, - [Stringify("numberFour")] Four, - [Stringify("Number 5")] Five -} - -Console.WriteLine(Number.One.Stringify()); -Console.WriteLine(Number.Two.Stringify()); -Console.WriteLine(Number.Three.Stringify()); -Console.WriteLine(Number.Four.Stringify()); -Console.WriteLine(Number.Five.Stringify()); - -// Output: -// NumberOne -// number_two -// number-three -// numberFour -// Number 5 -``` diff --git a/src/Strinum/Strinum.csproj b/src/Strinum/Strinum.csproj index 3b04666..850b43b 100644 --- a/src/Strinum/Strinum.csproj +++ b/src/Strinum/Strinum.csproj @@ -34,8 +34,8 @@ - - + +