Standard delegates in C# [closed]

There are some Delegates predefined in C#

I know these:

EventHandler // Default event callbacks
EventHandler<T> // Default event callbacks with custom parameter (inheriting from EventArgs)
Action // Function without return value and without parameter
Action<T1, T2, T3, T4> // Function without return value and 1-4 parameters
Func<T1, T2, T3, T4, TResult> // Methos with 0-4 parameters and one result type
Predicate<T> // equivalent to Func<T, bool>

There are many more for special cases and generated form parts of the framework, but these are often good to use in self written code.

If you know some more useful add them. Otherwise this is answered.


They're not predefined in C#. They're defined by the framework.

The Action and Func delegate families are wider than you've shown - they go up to

Action<T1, T2, T3, T4>

and

Func<T1, T2, T3, T4, TResult>

Another common-ish one in .NET 2.0 for list manipulation (before LINQ) is Predicate<T>.

For working with threads:

ThreadStart
ParameterizedThreadStart
WaitCallback
TimerCallback
AsyncCallback

I like to use Predicate<T> which is equivalent to Func<T, bool>


Goto Reflector Search for System.MulticastDelegate and check the derived types. You will get list of all the Delegates you are looking for.