title: Howto override List<T> Contains
body: <p>I want to compare a property instead of the entire object using a List[MyObject]. I therefore use IEquatable[MyObject] but the compiler still wants MyObject instead of the string property. Why?</p>
  
  <p>Here is what I got:</p>
  
  <pre><code>public class AnyClass
  {
      public List&lt;AnyOtherClass&gt; MyProperty { get; set; }        
      public string AnyProperty { get; set; }
  
      public AnyClass(string[] Names, string[] Values, string AnyProperty)
      {
          this.AnyProperty = AnyProperty;
          this.MyProperty = new List&lt;AnyOtherClass&gt;();
          for (int i = 0; i &lt; Names.Length; i++)
              MyProperty.Add(new AnyOtherClass(Names[i], Values[i]));
      }
  }
  
  public class AnyOtherClass : IEquatable&lt;string&gt;
  {
      public AnyOtherClass(string Name, string Values)
      {
          this.Name = Name;
          this.Values = Values.Split(';').ToList();
      }
  
      public string Name { get; set; }
      public List&lt;string&gt; Values { get; set; }
  
      public bool Equals(string other)
      {
          return this.Name.Equals(other);
      }
  }
  
      private void DoSomething()
      {
          string[] Names = new string[] { "Name1", "Name2" };
          string[] Values = new string[] { "Value1_1;Value1_2", "Value2" };
          AnyClass ac = new AnyClass(Names, Values, "any Property");
  
          if (ac.MyProperty.Contains("Name1")) //Problem is here...
              //do something
      }
  </code></pre>