Hello everyone. I have this noob question, and I wouldn't like to bother anyone with it, but I couldn't find an answer on my own after like 3 hours of web-search.
So here I come. I have this class which I only use for storing different types of data ordered in properties (which also have some events fired so the user of the class can do something specific when something has changed, etc). Anyways, the class, as far as i know and understand, doesn't have any unmanaged resources. I wanted to implement a counter for the class instances so I tried with a
Public Shared Property Count As Integer
and in the constructor i added
TheClass.Count += 1
But the problem comes when i want to substract from that property, I mean, I can't know when an instance of my class has been disposed... Or do I? If so, How? Or else, Should I Implement IDisposable so I can have an explicit destructor and fire the event manually? (a.k.a. substract 1 at the disposing time)
Also, now that we are in subject, If I must unavoidably use IDisposable, can anyone share some links so I can learn like 'Step by step' everything related to managed, unmanaged types/objects, the garbage collector, and... I don't know what else could be of use?
Anyways, for the moment, if someone can only answer the first part of this question, I would be very grateful.
Thank you in advance.