title: Get the column name from list
body: <p>I would like to fetch the column names from List. As I have a class </p>
  
  <pre><code>public class DetailView
  
      {
          public string SiteName { get; set; }
          public string ItemType { get; set; }
          public string AssetStorage { get; set; }
      }
  </code></pre>
  
  <p>and in some method in controller am filling the data into Session. Now I want to get the column names for some reason. Am putting my session data into that list.</p>
  
  <pre><code>List&lt;DetailView&gt; objgrdDtls = new List&lt;DetailView&gt;();
  objgrdDtls = (List&lt;DetailView&gt;)Session["datasetVal"]; 
  </code></pre>
  
  <p>I would like to have the Column name. Pleas note by doing the below code i got the value of that particular column name. restult1 has the column value. </p>
  
  <pre><code>var result1 = objgrdDtls.Where(p =&gt; p.SiteName.ToLower().Contains(txt1));
  </code></pre>
  
  <p>But all i need is Column name. So how do i get that.  </p>
  
  <pre><code>stringColumnname = objgrdDtls.get(columnaname =&gt; some filter)?
  </code></pre>
  
  <p>Is this is the way how to get column names?
  Not sure how to get the column name one by one? 
  Thanks.</p>