Skip to content

Commit

Permalink
utilizing nameof for stronger typing (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmissile authored and ardalis committed Dec 5, 2017
1 parent c459a97 commit bb7edfc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Define your smart enum by inheriting from `SmartEnum<TEnum, TValue>` where `TEnu
```c#
public class TestEnum : SmartEnum<TestEnum, int>
{
public static TestEnum One = new TestEnum("One", 1);
public static TestEnum Two = new TestEnum("Two", 2);
public static TestEnum Three = new TestEnum("Three", 3);
public static TestEnum One = new TestEnum(nameof(One), 1);
public static TestEnum Two = new TestEnum(nameof(Two), 2);
public static TestEnum Three = new TestEnum(nameof(Three), 3);

protected TestEnum(string name, int value) : base(name, value)
{
Expand Down
7 changes: 3 additions & 4 deletions src/SmartEnum.UnitTests/TestEnum.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using Ardalis.SmartEnum;
using Xunit;

namespace SmartEnum.UnitTests
{
public class TestEnum : SmartEnum<TestEnum, int>
{
public static TestEnum One = new TestEnum("One", 1);
public static TestEnum Two = new TestEnum("Two", 2);
public static TestEnum Three = new TestEnum("Three", 3);
public static TestEnum One = new TestEnum(nameof(One), 1);
public static TestEnum Two = new TestEnum(nameof(Two), 2);
public static TestEnum Three = new TestEnum(nameof(Three), 3);

protected TestEnum(string name, int value) : base(name, value)
{
Expand Down

0 comments on commit bb7edfc

Please sign in to comment.