Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Visual Studio 2010 extension to sort methods?

StyleCop mandates a particular sort order for the contents of C# files. For example, fields should be declared before methods and public declarations should come before private ones.

It would be useful to have a Visual Studio extension to move these things into that order automatically.

Does a good extension exist for this (I've found CodeSorter, but the feedback suggests it's very buggy)? Or are there any extensions or shortcuts that make it less painful to reorder this content manually?

like image 571
Matthew Strawbridge Avatar asked Dec 03 '11 20:12

Matthew Strawbridge


People also ask

How do I sort a method in Visual Studio?

To sort your file, open the file via solution explorer: Right click the open file. Code Maid menu (likely near the top of the right click menu) Click Reorganize Active Document.

How do I see all methods in Visual Studio?

CTRL - F12 brings up the go to member navigation window in Resharper. It lists all the methods in the class and gives you the option to search.

What is CodeMaid?

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.

What is extension in Visual Studio?

Extensions are add-ons that allow you to customize and enhance your experience in Visual Studio by adding new features or integrating existing tools. An extension can range in all levels of complexity, but its main purpose is to increase your productivity and cater to your workflow.


1 Answers

You can try with Regionerate :

Regionerate is an automated tool which helps you to preserve your code's layout over time. Regionerate lets you define regions in your code and determine the way members (fields, methods, properties etc.) should be placed inside them. Regionerate is a zero-friction tool - when setting up, you can choose a Code Layout (the way you want your code to look) or just use the default Code Layout. From that moment on, Regionerate will make sure your code follows that Code Layout.

like image 60
aleroot Avatar answered Sep 21 '22 02:09

aleroot