Quote:
private void AddRow(DataTable dataTable, IList<object> columnValues)
{
DataRow rowModelWithCurrentColumns = dataTable.NewRow();
dataTable.Rows.Add(rowModelWithCurrentColumns);
}
Your code ignores the
columnValues
parameter, and instead adds a new completely blank row.
You either need to update the
rowModelWithCurrentColumns
with the values from the
columnValues
list, or convert the list to an array and call the
DataRowCollection.Add[
^] overload which accepts the values for the new row.
private void AddRow(DataTable dataTable, IList<object> columnValues)
{
dataTable.Rows.Add(columnValues.ToArray());
}