There is

DataTable dt 

It has a couple of lines. I can delete a line like this:

 dtRows[0].Delete(). 

Question : How exactly instead of the deleted line to add another, precisely for the same index?

  • Through Delete you do not delete the line, but mark it for deletion. It will save its index in the row collection. Why do you need a tie to the index? - kodv

1 answer 1

In DataTable , you can insert a DataRow by index.

Code example:

 DataTable dt; //..... dt.Rows.InsertAt(new DataRow(...), 0);