Information Technology Reference
In-Depth Information
Generic Delegates
Generic delegates are very much like non-generic delegates, except that the type parameters
determine the characteristics of what methods will be accepted.
To declare a generic delegate, place the type parameter list in angle brackets after the
delegate name, and before the delegate parameter list.
Type parameters
↓
delegate S MyDelegate<S, T>(
T value
);
↑
↑
Return type
Delegate parameters
Notice that there are two parameter lists: the delegate parameter list and the type
parameter list.
The scope of the type parameters includes
-
The return type
-
The formal parameter list
-
The constraint clauses