title: Multiple .Contains(...) on a list of custom class objects
body: <p>I would like to have multiple <code>.Contains(...)</code> methods on a list of Person objects, in particular a <code>.Contains([Person])</code> and <code>.Contains([int])</code> similar to how I can have <code>.Equals([Person])</code> and <code>.Equals([int])</code>. <code>.Contains([int])</code> is the problem because an int is an invalid argument for <code>.Contains(...)</code>.</p>
  
  <p>Person class</p>
  
  <pre class="lang-cs prettyprint-override"><code>private class Person
  {
      private int number;
      private string name;
  
      public Person(int number, string name)
      {
          this.number = number;
          this.name = name;
      }
  
      public override bool Equals(object obj)
      {
          if (obj is int) return Equals((int) obj);
          if (obj is Person) return Equals((Person) obj);
          return false;
      }
  
      public bool Equals(int otherNumber)
      {
          return number == otherNumber;
      }
  
      public bool Equals(Person otherPerson)
      {
          if (number != otherPerson.number) return false;
          if (name != otherPerson.name) return false;
          return true;
      }
  }
  </code></pre>
  
  <p>And this is what I am doing</p>
  
  <pre class="lang-cs prettyprint-override"><code>Person a = new Person(1, "James");
  Person b = new Person(1, "James");
  
  List&lt;Person&gt; persons = new List&lt;Person&gt;();
  persons.Add(a);
  
  a.Equals(b); // True
  a.Equals(1); // True
  persons.Contains(b); // True
  persons.Contains(1); // Does not work
  </code></pre>