BusinessListBase & ReadOnlyListBase, generic "Find" method missing

BusinessListBase & ReadOnlyListBase, generic "Find" method missing

Old forum URL: forums.lhotka.net/forums/t/3157.aspx


ixman posted on Monday, July 09, 2007

Hi,

Does anyone know why there is no generic "Find" method implemented in the BusinessListBase & ReadOnlyListBase classes?

Any good workaround other than just implement a "Find" method with the required "predicate" on each class that inherit those classes?

 

Thank you,

George

 

RockfordLhotka replied on Monday, July 09, 2007

Primarily because the concept isn't on the base classes from which they derive. However, the predicate methods are on the wish list (www.lhotka.net/cslanet/wishlist.aspx).

On the other hand, LINQ makes them largely useless, and so I may never implement them.

On the third hand, all these things are dangerous (Find<> and LINQ) because they return lists that are not linked to the original. So you might do a find query and get back a list of matching results. You might then add or remove an item from that list - which of course would have no impact on the real list...

This is why Csla.FilteredBindingList is probably your best option. It effectively does a find operation that returns all matching results, using a delegate method (much like generic Find). But the resulting list is linked to the original so you can add and remove items from the filtered list and those changes are actually reflected in the real list.

ixman replied on Monday, July 09, 2007

Hi Rocky,

I'll go for the Csla.FilteredBindingList. The "link to the original list" feature is very handy.

 

Thank you,

George

Copyright (c) Marimer LLC