-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from xin9le/feature/more-compatibility
Improves System.Enum compatibility
- Loading branch information
Showing
14 changed files
with
1,350 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using BenchmarkDotNet.Attributes; | ||
using EnumsNET; | ||
using FastEnumUtility.Benchmarks.Models; | ||
using _FastEnum = FastEnumUtility.FastEnum; | ||
|
||
namespace FastEnumUtility.Benchmarks.Scenarios; | ||
|
||
|
||
|
||
public class ToStringUndefinedBenchmark | ||
{ | ||
private const Fruits Value = (Fruits)byte.MaxValue; // undefined value | ||
|
||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
_ = Enum.GetNames<Fruits>(); | ||
_ = Enums.GetNames<Fruits>(); | ||
_ = _FastEnum.GetMembers<Fruits>(); | ||
} | ||
|
||
|
||
[Benchmark(Baseline = true)] | ||
public string NetCore() | ||
=> Value.ToString(); | ||
|
||
|
||
[Benchmark] | ||
public string EnumsNet() | ||
=> Value.AsString(); | ||
|
||
|
||
[Benchmark] | ||
public string FastEnum() | ||
=> Value.FastToString(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.