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