Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fast easy refactoring in visual studio

I have a large project that is quite a mess. There's God classes, poor variable naming, poor indentation and spacing...among other issues.

I'm looking for a quick and easy way to make marketable improvements to such a project. In Visual Studio 2010 CTRL + K and CTRL + D gives me fast code cleanup. Organize usings takes out unused namespaces. But, both only seem to work on 1 page. Can I apply these changes to a project? Are there any similar cleanup techniques or free and reliable 3rd party addons?

like image 856
P.Brian.Mackey Avatar asked Jul 11 '11 14:07

P.Brian.Mackey


People also ask

How do I refactor in Visual Studio?

Clicking on the Code Action lightbulb or using the Quick Fix command Ctrl+. will display Quick Fixes and refactorings. If you'd just like to see refactorings without Quick Fixes, you can use the Refactor command (Ctrl+Shift+R).

How do I enable quick actions and refactoring in Visual Studio?

You can also press Ctrl+. anywhere on a line to see a list of available Quick Actions and refactorings. To see potential fixes, select either the down arrow next to the light bulb or the Show potential fixes link. A list of available Quick Actions is displayed.

Does refactoring make software run faster?

Reasons why Refactoring is Important: To improve the design of software/application. To make software easier to understand. To find bugs. To make program run faster.


3 Answers

Try out Resharper-- it can do what you're looking for.

like image 71
Matt Cofer Avatar answered Oct 23 '22 08:10

Matt Cofer


One third party extension that I use that is free is DevExpress' Coderush Xpress (For C# and VB), which is the free edition of their full product. The great thing about this is that the express edition still lets you add CodeRush plugins to it (in addition to several project-wide refactoring options), which opens you up to a ton more options than just the Visual Studio Plugins.

Here is a huge list of the plugins available for CR Xpress.

like image 41
Ryan Hayes Avatar answered Oct 23 '22 06:10

Ryan Hayes


I have been using Visual Assist X for quite some time, and I found it very useful. It is not free, and it may not automate the sweeping changes you seem to be looking for, but it makes simple refactoring much easier.

P.S. I have been using it for C++, not C#. But if anything, I would assume that it would have more capabilities for C#.

like image 1
Dima Avatar answered Oct 23 '22 06:10

Dima