Use generic event handler instances
Use generic event handler instances
Microsoft docsDescription
Before .NET Framework 2.0, in order to pass custom information to the event handler, a new delegate had to be declared that specified a class that was derived from the System.EventArgs class. In .NET Framework 2.0 and later versions, the generic System.EventHandler`1 delegate allows any class that's derived from System.EventArgs to be used together with the event handler.
Cause
A type contains a delegate that returns void and whose signature contains two parameters (the first an object and the second a type that is assignable to EventArgs), and the containing assembly targets .NET.
By default, this rule only looks at externally visible types, but this is configurable.
How to fix violations
To fix a violation of this rule, remove the delegate and replace its use by using the System.EventHandler`1 delegate.
If the delegate is autogenerated by the Visual Basic compiler, change the syntax of the event declaration to use the System.EventHandler`1 delegate.
When to suppress
Do not suppress a warning from this rule.