Event (C # programming guide)

Source: Internet
Author: User

Events (C # programming guide) when other classes or objects are concerned, classes or objects can notify them through events. The class for sending (or triggering) events is called "publisher", and the class for receiving (or processing) events is called "subscription ". In typical C # windows forms or web applications, you can subscribe to events caused by controls (such as buttons and lists. You can use Visual C # integrated development environment (IDE) to browse events published by controls and select the events to process. IDE automatically adds the empty event handler method and the Code for subscribing to the event. For more information, see How to subscribe to and unsubscribe to events (C # programming guide ). Event overview an event has the following features: the publisher determines when an event is triggered, and the consumer determines what action to perform to respond to the event. An event can have multiple subscribers. One subscriber can process multiple events from multiple publishers. Events without subscribers will never be called. Events are usually used to notify users of operations (for example, click a button in the graphic user interface or select a menu ). If an event has multiple subscribers, multiple event handlers are synchronously called when the event is triggered. To call events asynchronously, see call synchronous methods in asynchronous mode. You can use the event synchronization thread. In the. NET Framework class library, events are based on the eventhandler delegate and eventargs base class. (Source: msdn)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.