title: Filter abstract classes from list
body: <p>I have a <code>new List&lt;AbstractClass&gt; ()</code> that contains some different implementations. I want to filter out some implementations due to specific conditions. How to do it properly?</p>
  
  <pre><code>1) if (condition1 &amp;&amp; type is Implementation1) ...
  
  2) if (condition2 &amp;&amp; implementation.Name == "Implementation 1") ...
  
  3) if (condition3 &amp;&amp; implementation.Type == EnumType.Type1) ...
  </code></pre>
  
  <p>I think 1) is bad, 2) does not work at compile time 3) may be good?</p>
  
  <p>Any suggestions for other desgin?</p>
  
  <p>(coudn't post it on programmers.SE because of ban)</p>
  
  <p>Edit:
  More details. Imagine abstract class (or interface):</p>
  
  <pre><code>class abstract MessagePrinter
  { 
      void Print (string message);
  }
  </code></pre>
  
  <p>and class <code>ConsolePrinter : MessagePrinter</code> which prints message on console. So when due to some reasons I want to stop printing message on console, I need to remove that implementation from my <code>List&lt;MessagePrinter&gt;</code>. But what if ConsolePrinter is wrapped using <code>UpperCaseMessagePrinter</code>?</p>
  
  <pre><code>class UpperCaseMessagePrinter : MessagePrinter
  {
      public UpperCaseMessagePrinter (MessagePrinter source) { /* ... */ };
  
      void Print (string message)
      {
          source.Print (message.ToUpper());
      }
   }
  </code></pre>
  
  <p>All that type checking will be useless. Solution #3 with enum helps a bit, but is not perfect :/</p>