ReSharper conventions for names of event handlers
Personally, I'd suggest renaming the methods. Generally I think VS comes up with terrible names for both controls and events.
I prefer to make a method name say what it does, not what calls it. That promotes reuse as well. Admittedly the signature of an event handler is often not ideal for reuse - I'd argue that often a lambda expression calling a method with more sensible parameters would be useful:
button.Click += (sender, args) => SaveCurrentDocument();
but obviously the designer doesn't support that :(
Of course, renaming all the methods is going to be more work than just changing the R# settings, if you can find some that work...
C# + Resharper - Events method with underscore - Naming convention
These underscores are created by the default Visual Studio WinForm designer (when you double click on the event name in properties panel VS creates a method with this name). I am not sure what is the convention in WCF. This doesn't have anything to do with resharper - you will observe the same behaviour if you disable it. I don't think it is configurable.
You can always rename these methods after they are created (in the usual way - using Resharper).
ReSharper naming style for event methods
On ReSharper | Options | Languages | C# | Naming Style
check Override common settings, then click on Advanced settings.
Then you should have this on Event subscription on fields : $object$_$event$
. Press OK on both windows and you are good to go.
Renaming event handlers of a legacy WinForms application using Resharper
I wouldn't use Resharper for this, I'd just do a straightforward regex text find/replace for void On{.+}\(object sender, EventArgs e\)
.
ReSharper 9.2 produces warning for nameof with event name
It's a bug. It's fixed in version 10.
Naming Event Handlers: How to make the first letter uppercase
The "EventHandler Naming" extension for Visual Studio 2010 allows you to configure precisely how to generate event handlers from the visual studio designer.
For instance you could configure it with "On$(SiteName)$(EventName)" and then specify that the SiteName should be PascalCased.
The extension can be downloaded here
Resharper suggestion Page_Load = PageLoad
OnLoad
and Page_Load
are essentially the same. Page_Load
is invoked via reflection if AutoEventWireup is enabled on the Page
. OnLoad is a protected virtual method of the Control
class (which the Page
class inherits).
See Inside AutoEventWireup for an in-depth analysis of how AutoEventWireup works and why it exists.
The StackOverflow community also has some input on whether it is better to handle the Load
event or override the OnLoad
method.
Web control naming convention and ReSharper
I prefix all my UI elements with "ux" for user experience. I prefer this to txt, lbl, etc. because it makes it easy to change the control type. As far as ReSharper goes, I turned off that naming convention check while working in ASP.NET.
ReSharper Type Members Layout Pattern - Grouping Event Handlers
This is a known bug in ReSharper. I submitted a ticket for it and they will include a fix in a future release. http://youtrack.jetbrains.net/issue/RSRP-275049
Related Topics
Creating Powerpoint Presentations Programmatically
Connecting to Oracle Database Through C#
"An Internal Error Occurred." When Loading Pfx File with X509Certificate2
How to Create an Xml Document Using Xmldocument
System.Net.Webexception: the Remote Name Could Not Be Resolved:
How to Reduce Memory Consumption of PDFptable with Many Cells
Best Way to Handle Integer Overflow in C#
Remove the Title Bar in Windows Forms
Differencebetween Casting and Coercing
Dynamic Lang. Runtime VS Reflection
Best Way to Store Encryption Keys in .Net C#
Need a Way to Reference 2 Different Versions of the Same 3Rd Party Dll
Moq: Unit Testing a Method Relying on Httpcontext
Cssrewriteurltransform with or Without Virtual Directory
What's the Role of Gethashcode in the Iequalitycomparer<T> in .Net