There is a ready arrey that you need to throw in each line. But if you add the first bool which must be necessarily a fals ...

it will not work like this:

dataTable.Rows.Add(false, otherCells ); 

where otherCells is an array with the remaining cells of the date ... And how to do this correctly:

    1 answer 1

    Suppose there are a table and an array:

     DataTable dataTable = new DataTable(); dataTable.Columns.Add("ColumnA", typeof(bool)); dataTable.Columns.Add("ColumnB", typeof(int)); dataTable.Columns.Add("ColumnC", typeof(int)); var otherCells = new object[] { 1, 2 }; 

    The simplest way to the forehead:

     dataTable.Rows.Add(false, otherCells[0], otherCells[1]); 

    A more semantic example:

     var row = dataTable.NewRow(); row["Column1"] = false; row["Column2"] = otherCells[0]; row["Column3"] = otherCells[1]; dataTable.Rows.Add(row); 

    If there are a lot of columns in the table and, accordingly, there are many elements in the array, in order not to list them manually, you can do this:

     var list = otherCells.ToList(); list.Insert(0, false); dataTable.Rows.Add(list.ToArray());