ReSharper Ninja tricks - Generate code from usage

I’ve been a heavy ReSharper user, fan, and addict since I first tried it back in 2007. Over the years I’ve developed the way I code leveraging the powerful productivity features of ReSharper and Visual Studio.

I present a series of my favorite Ninja tricks and workflows to inspire others to improve their skills and I encourage you to do the same, either in the comments section or elsewhere.

You can find this and other power tips with the ReSharper user tip tag 

Generate code from usage + Move to folder

Category: Workflow

Following test-driven development I often define my unwritten classes by first using it in a unit test. I then use Create class and Create method or property to generate the code from usage. As the class gets created in the same file as the unit test I use Move to folder to put the class in the production code assembly. Namespaces and using statements are fixed automatically.

 

Create class from usage
Place the marker on the class name in red and hit Alt+Enter

arrow-down

Create method from usage

Place the marker on the method name in red and hit Alt+Enter

arrow-down

Move to folder

Place the marker on the class name and hit Ctrl+R, O. Then pick the folder you want the class to move to.

Loading
Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.