C #: Delegating actions against an explicit delegate

Just quick: what do people think about how to use Action delegates for public class events and not define their own types of event delegates? I know that many people use actions for "secondary" delegates, for example, in the extension methods lamma and .ForEach (), etc., But for real members of a class class, uses Actions - is it a good idea? What is β€œbest practice” in this area.

thanks

+6
c # events delegates
source share
1 answer

Instead of Action, I use EventHandler<TEventArgs> for any event announcements. This eliminates the need for me to define my own delegate type. It also has the added benefit that the data type is derived from System.EventArgs and therefore works great with .Net event templates.

+11
source share

All Articles