I have the following code, which does work:
var dataSource = (from p in dv.ToTable().AsEnumerable() where filter(p) select p).AsDataView();
filter is a Func<DataRow, bool>
dv is a DataView
dataSource is being used as a DataSource for a DataGrid.
Anyhow, it strikes me as a bit ugly that I am calling ToTable, AsEnumerable, and AsDataView, so I was wondering if there is a way to reduce the number of calls.
Is this as simple as I can make it?
Edit: The DataGrid has pagination, and I make use of the dataSource to determine the total number of entries. I'm not especially worried about the efficiency of this; dv only has a few thousand items and the table is being maintained in memory.