ReSharper conventions for names of event handlers

前端 未结 4 1067
小鲜肉
小鲜肉 2020-11-29 01:23

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 no

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 01:56

    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'.

提交回复
热议问题