title: Avoid copying & pasting of almost generic code in subclasses
body: <p>I currently have a class which encapsulates a list of typed objects and implements some interfaces like IEnumerable. I need a second class with additional, slightly different properties. So I will be creating a base class A and derive new class B and new class C from A.</p>
  
  <p>However I have code (e.g like code for .Find using Delegates) which is almost the same in B and C. The only difference is that the code in B searches the private list of typed objects (let's say Person) and the code in C searches a private list of different objects (let's say Animal):  </p>
  
  <pre><code>    private static bool Find(Person xx)
      {
          if (xx.Id == someID)
          {
              return true;
          }
      else
          {
              return false;
          }
      }
  </code></pre>
  
  <p>As I want to avoid copying/pasting, my question is: What is a good strategy to avoid something like that?</p>
  
  <p>The only way I imagined was to declare a list of generic objects in A and point the methods in A to that. In B and C I would then not have any code, however I lose all benefits of a typed list.</p>