title: How to compare object and List<> and object.value null when the value doesn't exist in list
body: <p>I need to compare between my object and a list.
  List contains attribute "nom_colonne", it fill by a query and the result is a list of attributes (same like my object AppareilsReparations)</p>
  
  <p>For example :
  if droit_utilisateur.nom_colonne = "Num_dossier" 
  so i keep the value in arp.num_dossier</p>
  
  <p>But if i don't have this value of my list droit_utilisateur :
  arp.num_dossier will be null.</p>
  
  <p>I wanted to cast my object with System.Collections.IList but impossible to cast. I have an error.</p>
  
  <pre><code>public class AppareilsReparations
  
  
  {
  
      public string Num_dossier { get; set; }
      //public string reference_aff { get; set; }
      public int Id { get; set; }
      public Guid Uid { get; set; }
      public string ref_sav { get; set; }
  
      public CodeDefaut codedefaut { get; set; }
      public CodeSymptome codesymptome { get; set; }
  }
  
  public class Droits
  {
      public int id { get; set; }
      public int utilisateur_id { get; set; }
      public string nom_table { get; set; }
      public string nom_colonne { get; set; }
  }
  
  
  AppareilsReparations arp = db.Query&lt;AppareilsReparations&gt;
                     ("select * from v_appareils_reparations where ref_sav_client =@ref_sav", new { ref_sav }).SingleOrDefault();
  
  List&lt;Droits&gt; droit_utilisateur = GetDroits("admin");
              //var appareil = new List&lt;AppareilsReparations&gt;();
  
              IList appareil = (IList)arp;
  
              var result = droit_utilisateur.Where(x =&gt; !appareil.Contains(x.nom_colonne)).ToList();
  </code></pre>