Example

The type-parameter-identifiers are specified at the point where a delegate object is created. Both the delegate and method associated with it must have the same signature. The following is an example of a generic delegate declaration.

The following example declares a generic delegate GenDelegate<ItemType>, and then instantiates it by associating it to the method MyMethod that uses the type parameter ItemType. Two instances of the delegate (an integer and a double) are created and invoked.