Declare Delegate CodeRush code provider
June 1st, 2012
A delegate is a special kind of object that holds a reference to a method. Once a delegate is assigned a method, it behaves exactly like that method. It can have parameters and a return value. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object.
CodeRush provides the Declare Delegate code provider that is available on references that refer a delegate which is not declared yet, for example:
the following result will be produced after the code provider is applied:
Another example:
the following delegate will be generated: