Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Lets say I have an observableCollection of classes:

C#
CustomClassName testClass = new CustomClassName();
ObservableCollection<CustomClassName> collection = new ObservableCollection<CustomClassName>();
testClass.SomeEvent += OnSomeEvent;
collection.add(testClass);


When I will delete items from a collection, do i need manually unsubscribe from events(OnSomeEvent) or should I leave it for a GC?
And if yes - what is the best way to do that?
Posted
Updated 12-Aug-15 20:10pm
v3

1 solution

I have got an answer on stackoverflow. Check this link
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 13-Aug-15 3:04am    
Please, credit the author of the answer, not yourself by self-accepting this "solution".
—SA
Alexander Dymshyts 13-Aug-15 8:36am    
I am pasting a link to an answer. Isn't it a credit?
Sergey Alexandrovich Kryukov 13-Aug-15 9:35am    
(Sigh...)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900