TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
C# Coding Standard

Category: Delegates and events

Synopsis:Delegates and events


Coding Rules

9@101 Do not make assumptions on the object's state after raising an event
9@102 Always document from which thread an event handler is called
9@103 Raise events through a protected virtual method
9@104 Use the sender/arguments signature for event handlers
9@105 Implement add/remove accessors if the number of handlers for an event must be limited
9@106 Consider providing property-changed events
9@107 Consider an interface instead of a delegate
9@108 Checked automatically with code checker Use delegate inference instead of explicit delegate instantiation when possible
9@110 Checked automatically with code checker Each subscribe must have a corresponding unsubscribe
9@111 Use generic event handler instances
9@112 Prevent passing null values for sender/object to event handler (for instance-based events)
9@113 Checked automatically with code checker Always check an event handler delegate for null
9@114 Checked automatically with code checker Do not use return values of callbacks in events