title: Datareader and list
body: <p>I am trying to create a list as below and updating it with values from the datareader. I need help in writing the code to update this list from the data reader.</p>
  
  <pre><code>internal IList&lt;FilingDto&gt; LoadStatusDtofromReader(IDataReader reader)
          {
              IList&lt;FilingDto&gt; filingstatus = new List&lt;FilingDto&gt;();
  
              while (reader !=null &amp;&amp; reader.Read())
               {
                  var dto = new FilingDto();
                  var Year = (Decimal)reader["Year"];
                  dto = new FilingDto()
                  {
  
                      Controllerid = (Guid)reader["Collectorid"],
                      Status = DBNull.Value.Equals(reader["Status"]) ? string.Empty : reader["Status"].ToString(),
                      Year = Convert.ToInt32(Year),
                      Level = DBNull.Value.Equals(reader["Level"]) ? string.Empty : reader["ServiceLevel"].ToString()
                  };
  
                  filingstatus.Add(dto);
              }
  
              return status;
          }
  </code></pre>
  
  <p>The code to read from the datareader is as below but i am stuck in between please help me complete this</p>
  
  <pre><code>DataTable FilingStatus = new DataTable("FilingStatus");
                  SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Connectionstring"].ConnectionString);
                  sqlcon.Open();
                  SqlCommand cmd = new SqlCommand("select Collectorid, Status, Year, Level from dbo.abc", sqlcon);
  
                  using (IDataReader dr =  
  </code></pre>