Calling delegates individually?

前端 未结 4 1542
逝去的感伤
逝去的感伤 2021-02-15 02:56

if I have a delegate like so:

 Delegate void Render();
 Render ToRender;

And use it here:

 ToRender += FunctionRender;
 ToRende         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-15 03:08

    thats not how delegates and events work. all methods will automatically be invoked by the framework. event handlers should be able to be executed completely independent of any other handlers. if you need to control the flow more tightly, you should think about redesigning your approach.

    perhaps 3 events/delegates - similar to the way asp.net does it. PreRender, Render and PostRender. im not sure what you are doing, but this sounds like overkill to me. just thought i would throw it out.

提交回复
热议问题