If I have the following code:
MyClass pClass = new MyClass();
pClass.MyEvent += MyFunction;
pClass = null;
Will pClass be garbage collected? Or will it hang around still firing its events whenever they occur? Will I need to do the following in order to allow garbage collection?
MyClass pClass = new MyClass();
pClass.MyEvent += MyFunction;
pClass.MyEvent -= MyFunction;
pClass = null;