If you want to use LINQ on your DataView, you'll have to create your own extension method on the DataView. The DataView does not natively have a .ToList()
method, which is where the .ForEach()
is defined.
Create your Extension Method for the DataView.
public static class DataViewExtensions
{
public static List<DataRowView> ToList(this DataView v)
{
List<DataRowView> foo = new List<DataRowView>();
for (int i = 0; i < v.Count; i++)
{
foo.Add(v[i]);
}
return foo;
}
}
Your DataView can now be called this like:
inputView.ToList().ForEach(x=>x["IsVerified"]=1);
Some developers may prefer the full .NET foreach (var x in y)
statement, but this will do the same.
A full console application proo-of-concept: http://pastebin.com/y9z5n6VH