问题 In C# 7.1 the below is valid code: object o = new object(); switch (o) { case CustomerRequestBase c: //do something break; } However, I want to use the pattern switch statement in the following scenario: public T Process<T>(object message, IMessageFormatter messageFormatter) where T : class, IStandardMessageModel, new() { switch (T) { case CustomerRequestBase c: //do something break; } } The IDE gives me the error "'T' is a type, which is not valid in the given context" Is there an elegant