zoukankan      html  css  js  c++  java
  • 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.


  • 相关阅读:
    Codeforces 912 D. Fishes (贪心、bfs)
    Codeforces 908 D.New Year and Arbitrary Arrangement (概率&期望DP)
    HDU
    HDU
    POJ-2299 Ultra-QuickSort (树状数组)
    deque!
    HDU
    乘法逆元
    Codeforces 911D. Inversion Counting (数学、思维)
    Codeforces 909E. Coprocessor (拓扑、模拟)
  • 原文地址:https://www.cnblogs.com/smwikipedia/p/1127986.html
Copyright © 2011-2022 走看看