Delegate Usage Guidelines

A delegate is a powerful tool that allows the managed code object model designer to encapsulate method calls. Delegates are useful for event notifications and callback functions.

Event notifications

Use the appropriate event design pattern for events even if the event is not user interface-related. For more information on using events, see the Event Usage Guidelines.

Callback functions

Callback functions are passed to a method so that user code can be called multiple times during execution to provide customization. Passing a Compare callback function to a sort routine is a classic example of using a callback function. These methods should use the callback function conventions described in Callback Function Usage.

Name end callback functions with the suffix Callback.

See Also

Design Guidelines for Class Library Developers | Callback Function Usage