Thursday, 5 April 2012

Update DataTable using LINQ in C#

updating a Datable using LINQ is quite easy and also fast. so,here is how it works.
1-is column Index
10-is New Value
we can expand this as we wish,by using where and other extension methods available on Lists.
 
objDataTable.AsEnumerable().ToList().ForEach(p => p.SetField<int>(1, 10));

3 comments: