c# - Clear particular column values in DataTable -
i have data table 4 fields emp_no, amountpaid, amount_adjusted, adjustment_reason
i want clear values of adjustment_reason
column
i have tried below code :
for (int = adjustmenttable.rows.count - 1; >= 0; i--) { adjustmenttable.rows[i]["adjustmentreason"] = dbnull.value; }
its working fine. but can 1 suggest me code achieve using linq
you can write this:
adjustmenttable.rows .oftype<datarow>() .tolist() .foreach(r => r["adjustmentreason"] = dbnull.value);
but quite frankly i'm not sure how performant can large amount of data in datatable.
Comments
Post a Comment