C# – EventHandler type with no event args

ceventssignals

When we want to pass data to an event subscriber, we use EventArgs (or CustomEventArgs) for this.

.Net provides a build in type EventHandler that uses as a parameter an instance of EventArgs class that is build in as well.

What about cases, when I need to notify a subscriber that some action is over, for example search is over? I don't want to even use EventArgs, that won't contain anything.

Is there a build in type for signaling another class, without the need to use empty EventArgs?

Best Answer

I really would advise you to use the standard EventHandler patter here and just pass EventArgs.Empty; however, you can use Action as an event type of you really want - it is just unusual.