Built-in Delegate Types
Use built-in delegate types instead of defining new delegates.
We'll cover the following
Remember that a delegate’s declaration essentially defines a method signature with a return type. Instead of defining our own delegates, we can use delegates provided by the .NET platform.
The Action
delegate
The Action
delegate is a generic delegate with the following definition:
public delegate void Action<T>(T parameter);
It returns void
and accepts a type T
parameter. We can directly instantiate it:
Get hands-on with 1400+ tech skills courses.