I have a class that spawns another UI thread and does it's thing. I need to abort that thread and clean up whenever my parent class is destroyed. So how do I know when my parent class is destoryed?
Coming from C++ my first thought was to put this in the destructor. But C# doesn't really have any destructors - only finalizers and dispose - which from what I understand - may or may not be called (I guess it's a mood thing for the GC??).
That's great and simple - if you may or may not want to release your resources.
But where do you put code that ABSOLUTELY POSITIVELY MUST BE EXECUTED whenever an object is destroyed?