I've got this enum:
namespace MyApp.Internal.Enums
{
    public enum EServerType
    {
        API
    }
}
I am trying to use the Factory pattern to get a class according to a string, and this is my factory (with both the working code and the error):
using MyApp.Handlers.Interfaces;
using MyApp.Internal.Enums;
using MyApp.Services.Interfaces;
namespace MyApp.Handlers
{
    public class ServerCallerFactory : IServerCallerFactory
    {
        public IServerCaller GetServerCaller(string serverType)
        {
            if (serverType.ToUpper() == EServerType.API.ToString())
            {
            }
            switch (serverType.ToUpper())
            {
                case EServerType.API.ToString():
                    break;
                default:
                    break;
            }
        }
    }
}
I prefer switching over the string instead of using multiple if statements of course.
The if block isn't throwing any compiler error, however, the switch block is!
Error thrown by compiler: CS0426 The type name 'API' does not exist in the type EServerType.
Why is this happening and how to fix it?
