I’m using ReSharper and CodeMaid, both have their own “organize” code option but the problem is that i have no idea how to tell them what is an event and what is a method/function that i coded.
If i reorganize code (i want regions) it groups every control event and method together.
Is there a way to tell them what is a method and what is an event? or is there another extension that is specifically better for reorganizing code the way i want?
I want something like this:
private void button1_click(object sender, EventArgs e){}
private void MyMethod1(){}
private void MyMethod2(){}
private void button2_click(object sender, EventArgs e){}
to become:
#region Events
private void button1_click(object sender, EventArgs e){}
private void button2_click(object sender, EventArgs e){}
#endregion Events
#region Methods
private void MyMethod1(){}
private void MyMethod2(){}
#endregion Methods
5
Regions shouldn’t be used. Never.
If you want to organize methods, properties, fields, events, etc., you may be interested in following StyleCop rules and in making StyleCop checking mandatory during every commit.
Also, if you’re currently writing code in a basic text editor, you may be interested in moving to Visual Studio, where methods, properties, fields, events, etc. have distinctive icons in Intellisense which make it very easy to recognize visually. Note that Visual Studio Express is free.
14
Is there a way to sort code properly into regions dividing methods and events?
No.
Is there a way to sort code properly divide methods and events?
Yes. Follow the resharper guidelines, sorting by accessibility and then alphabetically. You can then use ctrl+e, ctrl+c (code cleanup) to use resharper to sort them for you.
2