Am using this mechanic here from official Microsoft docs because I need certain functionality that such a wrapper for enums can provide (ability to give enum values a different ToString() name): https://learn.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/enumeration-classes-over-enum-types
However I am stuck on how to restore the ability to use those enums in switch statements.
With the exact code from the example, the following code says "A constant value is expected".
var a = CardType.Amex;
switch(a)
{
case CardType.Amex:
{ } break;
}
Have tried "readonly static" as well. Const cannot be applied due to those being instances.
Is it true that there is no way to have switch() on any custom type in C#?