title: before adding check if object already exists in a list
body: <p>I am working on win-form app that has .<code>net 2.0</code> as framework. I have a list of an class in which i would like to check if the object already exist before adding it in list. I know i can use <code>.Any</code> of linq to do this but it does not work in my situation. I can not use <code>.contains</code> since the object will not be same as it has lot of properties , so I am left with a unique property to check if it is already added,but it is not working Code:</p>
  
  <pre><code>bool alreadyExists = exceptionsList.Exists(item =&gt;
         item.UserDetail == ObjException.UserDetail    
      &amp;&amp; item.ExceptionType != ObjException.ExceptionType) ;
  </code></pre>
  
  <p>My class</p>
  
  <pre><code>public class AddException
      {
          public string  UserDetail{ get; set; }
          public string  Reason { get; set; }
          public Enumerations.ExceptionType ExceptionType { get; set; }
  
      }
      public class Enumerations
      {
          public enum ExceptionType
          {
              Members = 1,
              Senders =2
          }
      }
  </code></pre>
  
  <p>Iniial situation </p>
  
  <pre><code>AddException objException = new AddException
                  {
                      Reason = "test",
                      UserDetail = "Ankur",
                      ExceptionType = 1
                  };
  </code></pre>
  
  <p>this object is added in list.</p>
  
  <p>Second time</p>
  
  <pre><code>AddException objException = new AddException
                  {
                      Reason = "test 1234",
                      UserDetail = "Ankur",
                      ExceptionType = 1
                  };
  </code></pre>
  
  <p>this should not be getting added in the list , but the <code>.Exist</code> check is failing and it is getting added in the list.</p>
  
  <p>Any suggestions.</p>