List doesn't support change events; BindingList would be a good substitute to support this scenario, and it also supports item-level change events if your type T implements INotifyPropertyChanged. In 3.0 and above, there is also ObservableCollection, which acts similarly to BindingList. It all comes down to interfaces such as IBindingList, IBindingListView, etc.From comments; for a 2.0/3.0 example of adding a Find to BindingList: public class MyBindingList : BindingList { public T Find(Predicate predicate) { if (predicate == null) throw new ArgumentNullException("predicate"); foreach (T item in this) { if (predicate(item)) return item; } return default(T); } } Note that in 3.5 (or in .
NET 2.0/3.0 with LINQBridge and C# 3.0) you don't need this - any of the LINQ extension methods would do the same thing.
This works, thanks, however with BindingList I don't have a compare method, to which I could pass a predicate (which I found extremely useful). I was using that to prevent duplicates in the List... Will I get around looping through the list checking the existence by a object property? – rdoubleui Dec 4 '09 at 14:01 You could use LINQ, which would work fine.
Or subclass BindingList and add some missing methods (very easy to do - let me know if you want to see how to do this with a predicate). – Marc Gravell? Dec 4 '09 at 14:40 I'd like to know how to solve that with an own predicate.
– rdoubleui Dec 7 '09 at 9:42.
If you want to get notified when a property get's changed you'll need to implement INotifyPropertyChanged See here for an example.
It wouldn't work with List, as Marc Gravell stated. So I'm following the approach with BindingList. – rdoubleui Dec 4 '09 at 14:07.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.