c# - What does Button.PerformClick do? -


i know might trivial question, wondering whether there advantage of calling button.performclick rather invoking click event of button directly. msdn documentation says:

generates click event button.

does mean same thing calling click event of button or there other special advantage?

an external caller knows nothing of subscribed events cannot call click handler - , events not allow obtain information subscribers. method allows separation of concerns, external callers can "play nice".

additionally:

  • it ensures polymorphism on virtual method applied
  • it applies rules - example: button disabled

if know event-handler, , aren't using polymorphism, , don't care whether disabled, , don't need worry event-handlers don't know - means : call event-handler method.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -