I was wondering what, if any, is there a differance between overriding the Dispose and overriding the OnDispose methods of a UltraTreeNode
Hello,
I will be happy to assist you with your question.
After researching all of the available methods for the UltraTree (Click here for UltraTree Members), I am unable to see the OnDispose method you are speaking of. Please let me know more details about what you wish to learn about the Dispose method.
its on the UltraTreeNode not the UltraTree
Hi,
Thank you for the update.
The following page explains your question regarding the overriding of Dispose and OnDispose methods:http://stackoverflow.com/questions/456299/best-practice-override-ondisposebool-disposing-vs-disposed-event-on-component
It mentions, "typically events are used by consumers so that they can be notified when events occur. " Essentially, if that is not why you need Dispose, then that's a situation where you'd override the OnDispose method.
This is a very typical structure for how events work. Almost every event on every control has a corresponding OnXXX method. The OnXXX method calls the event. So you could override the method to prevent the event from firing or to do some processing before or after the base method is called.
Thanks Guys I understand the event/Onxxx paradigm, but this is not what we are dealing with here. I am talking about the method Dispose not the event, I assume that the UltraTreeNode Dispose method “fires” the Dispose and calls the OnDispose method. It seems that the same functionally can be achieved by either overriding the Dispose method or the OnDispose method. I am trying to understand if there is any difference between the two appoches
There's not much practical difference.
For the most part, I think you probably are better off overriding the Dispose method or handing the event.Be sure to call the base implementation of course. But you have the option of adding your additional code either before or after calling the base, just in case it's important.