title: Looping within a Looping creates duplicates in DataTable C#
body: <p>I'm writing to loop within a loop to write to a data table but it produces duplicates.  I'm not sure what the issue might here.  I"m getting duplicate ID's from this API as a result of this loop</p>
  
  <pre><code>var users = api.Users.GetAllUsers();
  
  using (DataTable table = new DataTable())
  {
     var properties = users.Users[0].GetType().GetProperties();
  
      for (int i = 0; i &lt; properties.Count(); i++) 
      { 
          table.Columns.Add(properties[i].Name, typeof(String)); 
      }
  
     foreach (var user in users.Users)
     {
        DataRow newRow = table.NewRow();
        for (int j = 0; j &lt; properties.Count(); j++)
        {
              var colName = properties[j].Name;
              newRow[colName] = user.GetType().GetProperty(colName).GetValue(user, null);
        }
        table.Rows.Add(newRow);
  
        foreach (DataRow row in table.Rows)
        {
              Console.WriteLine(row["id"]);
        }
     }
  }
  </code></pre>