title: Using is operator with Interface to Generics
body: <p>I have a few generic classes that implement a common non-generic interface. I create my generic objects and add them to a list. How can I use LINQ, or any other method for that matter, to filter the list by the generic type. I do not need to know T at run-time. I added a type property to the interface and used LINQ to filter by it but I was hoping to use the is operator. Here's a simple example I threw together.</p>
  
  <p>Any Ideas?</p>
  
  <pre><code>interface IOperation
      {
          object GetValue();
      }
      class Add&lt;T&gt; : IOperation
      {
          public object GetValue()
          {
              return 0.0;
          }
      }
      class Multiply&lt;T&gt; : IOperation
      {
          public object GetValue()
          {
              return 0.0;
          }
      }
  
  
      private void Form1_Load(object sender, EventArgs e)
      {
          //create some generics referenced by interface
          var operations = new List&lt;IOperation&gt;
          {
              new Add&lt;int&gt;(),
              new Add&lt;double&gt;(),
              new Multiply&lt;int&gt;()
          };
  
          //how do I use LINQ to find all intances off Add&lt;T&gt; 
          //without specifying T?
  
          var adds =
              from IOperation op in operations
              where op is Add&lt;&gt; //this line does not compile
              select op;
      }
  </code></pre>