To work with DataGridView
, you need to implement the non-generic IList
, not the generic IList<T>
(or simpler and better: inherit from BindingList<T>
, which provides things like change notifications via INotifyPropertyChanged
). For working with LINQ-to-SQL I have some info on usenet that might be useful (assuming it still holds water - it has been a while).
re "rest of the problem"... can you be more specific?
Re filtering LINQ-to-SQL efficiently, you don't want to use Predicate<T>
; you want to use Expression<Func<T,bool>>
; this allows you to pass this down to the database via Queryable.Where
, i.e. (where you have an IQueryable<T>
source) something like:
IQueryable<T> data = tableSource;
// then for each filter "expr"
{
data = data.Where(expr);
}
Writing a true filtered list is very tricky. I've done it for in-memory objects (I can't post the code, though) - but it takes a lot of object tracking etc. Unless you absolutely need this, it may be easier to keep things simple and just display simple snapsnots, tracking just additions/removals. For simple snapshots, just ToBindingList()
may suffice...