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

mod rewrite - Using "?" when rewriting the URL -

.htaccess: Transfer name to index.php if not directory public -

Admob integration with pygame in android -