title: How to check if an object already exists in list of objects using C#
body: <p>I would like to add <code>classStudents</code> to the list <code>_ClassStudents</code> only if <code>classStudents</code> is not yet in the list.</p>
  
  <pre><code>public class ClassStudents{
  
     public Id {get; set;}
     public Name {get; set;}
     public List&lt;Student&gt; Student {get; set;}
  
  }
  
  
  
  public static List&lt;ClassStudents&gt; _ClassStudentsList = new List&lt;ClassStudents&gt;();
  
    public static void addClassStudents(ClassStudents classStudents)
    {
            //if( classStudents isn't in ClassStudentsList ) &lt;------
             _ClassStudentsList.Add(classStudents);
     }
  </code></pre>
  
  <p>How can I do this?</p>