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());