Adding items to list from DataRow
<p>I have following code to copy DataTable rows into my Object. But it overwrites previously added list items each time with the new row. What is wrong with my code?</p>

<pre><code>DataTable dt = GetDataTableByIndex(data, 1);
if (dt != null &amp;&amp; dt.Rows.Count &gt; 0)
{
   if (dt != null &amp;&amp; dt.Rows.Count &gt; 0)
   {
      providerQualification.ProviderDetails = new List&lt;ProviderDetail&gt;();
      ProviderDetail providerDetail = new ProviderDetail();
      foreach (DataRow row in dt.Rows)
      {
          providerDetail.ProviderName = row["Provider Name"].ToString();
          providerDetail.QualificationTime = row["Qualify Time (Sec.)"].ToString();
          providerDetail.ServiceableOffers = row["Total Serviceable Offers"].ToString();
          providerQualification.ProviderDetails.Add(providerDetail);
      }
  }
}
</code></pre>