ardalis / ardalis/SmartEnum

The switch statement contains multiple cases with the label value

Open
#205 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.4k
Forks
184
PR merge metrics
No merged PRs in 30d

Description

Hi
i am using package 2.0.1 getting compilation error when i use two cases together.

```
switch(role.Name) {
case nameof(CommonEnums.Roles.Root.Name):
case nameof(CommonEnums.Roles.User.Name):

break;
}
```

i get error The switch statement contains multiple cases with the label value '"Name"'. Any idea whats the work around this. Thank you.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the switch(role.Name) example against package 2.0.1 and inspect how the SmartEnum role names are exposed. Determine whether the duplicate nameof values come from the package or C# compilation behavior; done means documenting a verified workaround or a clearly scoped fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.