I have collectionView in my wpf application.
For sorting purpose, I add four “SortDescriptions” in it.
In the dispose method of the corresponding class, I would like to clear this list.’
If I call “SortDescriptions.Clear()”…will it dispose all 4 items ?…
if I set SortDescriptions = null…what will happen to those 4 items ?
Thanks.
SortDescriptions are managed code, i.e. they will become garbage collected when no longer referenced. Therefore, it does not matter whether you clear the list, or set it to null. Either way, they become eligible for garbage collection.