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
ActionandFuncdelegate families are wider than you’ve shown – they go up toand
Another common-ish one in .NET 2.0 for list manipulation (before LINQ) is
Predicate<T>.For working with threads: