Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
EngRajabi committed May 28, 2022
1 parent 8014225 commit 218cbc4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) .NET Foundation. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Supernova.Enum.Generators
# C# Better Enums Source Generator (Very Fast)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/EngRajabi/Enum.Source.Generator/master/LICENSE)
[![Nuget](https://img.shields.io/nuget/dt/Supernova.Enum.Generators?label=Nuget.org%20Downloads&style=flat-square&color=blue)](https://www.nuget.org/packages/Supernova.Enum.Generators)

# Supernova.Enum.Generators
# The best Source Generator for working with enums in C#
A C# source generator to create an enumeration class from an enum type.
With this package, you can work on enums very, very fast without using reflection.

Expand Down Expand Up @@ -30,7 +33,8 @@ public enum UserTypeTest
}
```

This will generate a class called `MyEnumExtensions` (by default), which contains a number of helper methods. For example:
This will generate a class called `EnumNameEnumExtensions` (`UserTypeTest` + `EnumExtensions`), which contains a number of helper methods.
For example:

```csharp
public static class UserTypeTestEnumExtensions
Expand Down Expand Up @@ -78,6 +82,8 @@ This will generate a class called `MyEnumExtensions` (by default), which contain
}
```

You do not see this file inside the project. But you can use it.

Usage
```csharp
var stringEnum = UserType.Men.StringToFast(); //Men;
Expand All @@ -87,6 +93,8 @@ var isDefined = UserTypeTestEnumExtensions.IsDefinedFast(UserType.Men); //true;
var displayEnum = UserType.Men.ToDisplayFast(); //مرد
```

If you had trouble using UserTypeTestEnumExtensions and the IDE did not recognize it. This is an IDE problem and you need to restart the IDE once.

Benchmark

![Benchmark](https://raw.githubusercontent.com/EngRajabi/Enum.Source.Generator/master/Supernova.Enum.Generators.png?v=1)
Expand Down

0 comments on commit 218cbc4

Please sign in to comment.