Removed reparent call from ParentingCollection.Dispose() method. If a class deriving from ParentingCollection wants to disconnect all its items in order to prevent collection elements from accessing their owner (which might have been disposed already), it can still Reparent() the collection to null manually

git-svn-id: file:///srv/devel/repo-conversion/nusu@17 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2007-05-10 19:11:28 +00:00
parent 84324eb936
commit 9268c3251f

View File

@ -69,13 +69,18 @@ namespace Nuclex.Support.Collections {
if(disposeItems) {
// Have the items do their cleanup work
Reparent(default(ParentType));
//Reparent(default(ParentType));
// Dispose of all the items in the collection that implement IDisposable
foreach(ItemType item in this) {
IDisposable disposable = item as IDisposable;
// If the item is disposable, we get rid of it
if(disposable != null)
disposable.Dispose();
/*else
Reparent(default(ParentType));*/
}
}