Short of cutting and pasting, is there a way to sort the methods in my classes in Visual Studio 2008? I like orderly code.
标签:
visual-studio
相关问题
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
- Visual Studio 2019 - error MSB8020: The build tool
- 'System.Threading.ThreadAbortException' in
- VS2017 RC - The following error occurred when tryi
相关文章
- How to show location of errors, references to memb
- How to track MongoDB requests from a console appli
- Visual Studio Hangs on Loading UI Library
- How to use Mercurial from Visual Studio 2010?
- Copy different file to output directory for releas
- Edit & Continue doesn't work
- “Csc.exe” exited with code -1073741819
- Visual Studio: Is there an incremental search for
This is a free plug-in that does what you are asking: http://www.visualstudiogallery.com/ExtensionDetails.aspx?ExtensionID=800978aa-2aac-4440-8bdf-6d1a76a5c23c
Update
Unfortunately the link is outdated. You can download Regionerate at http://www.rauchy.net/regionerate/docs/2007/05/download.html
Resharper will do a good job in a limited way. It depends on how much you want. For example, it wont go and reorder your overrides in an asp.net page based on lifecycle, or anything like that, but it will keep properties, fields, methods and what not clearly grouped
EDIT: By the eway i was refering to auto reordering aka reformatting.
ReSharper has Code Reordering functionality and a File Structure view that lets you do drag and drop reordering.
You may find or be able to make a macro to do this, but there is no built in functionality of VS to sort your methods. Some third party productivity tools like Resharper and CodeRush provide some functionality to reorder your code.
If you are using Resharper, you can change the Type Members Layout template so that it orders your code however you like. See under Resharper>Options>Languages>C#>Type Members Layout. alt text http://www.jetbrains.com/resharper/features/screenshots/40/automatic_member_layout_full.png
You can, for example, put methods with particular attributes first in your file... e.g. methods marked with NUnit's [Setup] and [TearDown] could come before methods marked with [Test] by placing a block like:
before:
and then have a catch-all for everything else:
The template system is very powerful and should meet your needs.