Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://msdn.microsoft.com/en-us/library/ms229012.aspx" rel="noreferrer">MSDN on naming events</a>:</p> <blockquote> <p>Events always refer to some action, either one that is happening or one that has occurred. Therefore, as with methods, events are named with verbs, and verb tense is used to indicate the time when the event is raised.</p> <p>√ <strong>DO</strong> name events with a verb or a verb phrase.</p> <p>Examples include <code>Clicked</code>, <code>Painting</code>, <code>DroppedDown</code>, and so on.</p> <p>√ <strong>DO</strong> give events names with a concept of before and after, using the present and past tenses.</p> <p>For example, a close event that is raised before a window is closed would be called <code>Closing</code>, and one that is raised after the window is closed would be called <code>Closed</code>.</p> <p>X <strong>DO NOT</strong> use "Before" or "After" prefixes or postfixes to indicate pre- and post-events. Use present and past tenses as just described.</p> <p>√ <strong>DO</strong> name event handlers (delegates used as types of events) with the "EventHandler" suffix, as shown in the following example:</p> <pre><code>public delegate void ClickedEventHandler(object sender, ClickedEventArgs e); </code></pre> <p>√ <strong>DO</strong> use two parameters named <em>sender</em> and <em>e</em> in event handlers.</p> <p>The sender parameter represents the object that raised the event. The sender parameter is typically of type <code>object</code>, even if it is possible to employ a more specific type.</p> <p>√ <strong>DO</strong> name event argument classes with the "EventArgs" suffix.</p> </blockquote> <p>So, events should be named with a verb or verb phrase. Instead of <code>OnSomething</code>, use <code>Something</code>, assuming that <code>Something</code> is actually a verb, like <code>Close</code>, <code>Click</code>, or <code>ManagedPiplelineAbandoning</code> and <code>ManagedPiplelineAbandoned</code>.</p> <p>The delegate for an event should be named with the <code>EventHandler</code> suffix, giving <code>CloseEventHandler</code>, <code>ClickEventHandler</code>, <code>ManagedPiplelineAbandoningHandler</code>, etc.</p> <p>For delegates that aren't related to an event, use a noun, like <code>EventProcessor</code> or <code>ItemRetriever</code>, while an instance of that delegate is a verb, like <code>processEvent</code> or <code>retrieveItem</code>.</p> <p>The casing of your delegate reference should be camel, unless the reference is not private. I can't think of a case where you'd have a non-private delegate field, though.</p> <p>However, since it is suggested to use the conventional event handler signature (i.e. <code>object sender, EventArgs e)</code>), you should <a href="http://msdn.microsoft.com/en-us/library/ms182178.aspx" rel="noreferrer">use a generic event handler</a> instead of defining your own. That is, your event would be defined as something like this:</p> <pre><code>event EventHandler&lt;SomethingEventArgs&gt; Something; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload