Okay - I've decided to try and enter the world of OOP, and I've decided to learn C#. There's no reason for this other than personal development. I started learning last week, and up until now Google has been good, but I think I need this one spelling out to me.
Firstly - I don't quite 'get' custom event handling. I can kinda make it work, but I don't understand it fully - in terms of events, delegates and handlers.
Secondly - and this is the bit I think I really need spelling out to me. I want to fire an event every time an object is created. That seems easy enough - just put it in the constructor.
I just don't know how to handle it - the examples I've looked at seem to show handling events PER object, but this needs to be global.
in other words, by purely running
MyClass test = new MyClass();
MyClass test2 = new MyClass();
MyClass test3 = new MyClass();
in the form, I might get the output
"New MyClass Created - ID is 1"
"New MyClass Created - ID is 2"
"New MyClass Created - ID is 3"
I'm told that classes shouldn't really interface with the GUI (and as I wanna try some multi threaded stuff later, this is a definite) I really need to understand how to make this work with events.
Ta for any help.