• Events解惑——来自MSDN


    Events are a special kind of multicast delegate that can only be invoked from within the class or struct where they are declared (the publisher class). If other classes or structs subscribe to the event, their event handler methods will be called when the publisher class raises the event.

    Events enable a class or object to notify other classes or objects when something of interest occurs. The class that sends (or raises) the event is called the publisher and the classes that receive (or handle) the event are called subscribers.


    Events have the following properties:

    • The publisher determines when an event is raised; the subscribers determine what action is taken in response to the event.

    • An event can have multiple subscribers. A subscriber can handle multiple events from multiple publishers.

    • Events that have no subscribers are never called.

    • Events are typically used to signal user actions such as button clicks or menu selections in graphical user interfaces.

    • When an event has multiple subscribers, the event handlers are invoked synchronously when an event is raised. To invoke events asynchronously, see Calling Synchronous Methods Asynchronously.

    • Events can be used to synchronize threads.

    • In the .NET Framework class library, events are based on the EventHandler delegate and the EventArgs base class.


  • 相关阅读:
    20160205
    20151120
    20151023
    20151023
    20140207
    yum工具介绍
    Linux程序包管理
    Linux任务计划、周期性任务执行
    10 压缩和解压缩工具和bash脚本编程
    9 btrfs文件系统
  • 原文地址:https://www.cnblogs.com/smwikipedia/p/1127986.html
Copyright © 2020-2023  润新知