tags:

views:

891

answers:

1

What are the Resharper 4 shortcuts to

  1. Create a class from usage? e.g. I type "var p = new Person();", and I want to now create the person class.

  2. Move this class to its own file? When the Person class exists in the same file next to my Order class, what is the shortcut to move it.

I can't seem to find these shortcuts on the cheatsheet or the Internet.

+10  A: 

Type out the line:

var p = new Person();

Person will highlighted in red as an error by Resharper. Put the cursor on it and press ALT+ENTER to invoke the quick-fix context menu. Select "Create class 'Person'"

The cursor will then be on the new class' name, so press ALT+ENTER to invoke the quick-fix menu again and select "Move to another file to match type name".

If you'd rather the class was moved to a different namespace, you can press SHIFT+CTRL+R and select "Modify Namespace...".

If you'd rather the class was moved to a different project, you can press SHIFT+CTRL+R and select "Move to Folder...".

Neil Barnwell