When I add new event handler for any event, VS creates method like object_Click
. But ReSharper underlines this method as Warning, because all methods should not have any delimeters such as "_".
How can I customize rules of ReSharper so that it doesn't underline such methods? Or may be I should rename such methods?
Thanks in advance.
Event handlers must have a name with the suffix EventHandler. The following example illustrates names that consist of the delegate name and the EventHandler suffix. Event handler naming conventions apply to pre and post event handlers.
To register a handler, use the addEventHandler() method. This method takes the event type and the handler as arguments.
In programming, an event handler is a callback routine that operates asynchronously once an event takes place. It dictates the action that follows the event. The programmer writes a code for this action to take place. An event is an action that takes place when a user interacts with a program.
For C# (or VB), make the following change:
ReSharper | Options | Languages | C# | C# Naming Style, Advanced settings... Change 'Event subscriptions on fields' from $object$_On$event$
to $object$_$event$
.
You may also want to add additional rules to entity kinds like 'Types and namespaces' to account for code-generated classes such as 'Default'. For example, add a new rule with a '' Name Prefix and a Name Style 'UpperCamelCase'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With