title: Switch based on generic argument type
body: <p>In C# 7.1 the below is valid code:</p>
  
  <pre><code>object o = new object();
  switch (o)
  {
      case CustomerRequestBase c:
          //do something
          break;
  }
  </code></pre>
  
  <p>However, I want to use the pattern switch statement in the following scenario:</p>
  
  <pre><code>public T Process&lt;T&gt;(object message, IMessageFormatter messageFormatter) 
      where T : class, IStandardMessageModel, new()
  {
      switch (T)
      {
          case CustomerRequestBase c:
              //do something
              break;
      }
  }
  </code></pre>
  
  <p>The IDE gives me the error "'T' is a type, which is not valid in the given context"
  Is there an elegant way to switch on the type of a generic parameter? I get that in my first example you are switching on the object and the second I'd want to switch on the type T. What would be the best approach to do this?</p>