0

In extension to this question, while retrieving the cell value, are there any more advantages other than improving the readability by using the column names instead of column numbers?

for (i = 0; i <= dt.Rows.Count - 1; i++)
{
    for (j = 0; j <= dt.Columns.Count - 1; j++)
    {
        var cell = dt.Rows[i].Field<double>("DoubleColumn");
        //var cell = dt.Rows[i][j];
    }
}
ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86
ashveli
  • 248
  • 6
  • 28
  • 1
    I imagine another benefit would be that if you added a new column between two existing columns, you wouldn't have to update the index numbers for all subsequent columns. – ProgrammingLlama Oct 17 '19 at 05:39
  • that would be another advantage!!! can anyone tell me if there are any other.... – ashveli Oct 17 '19 at 09:40

0 Answers0