Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ReSharper Essentials

You're reading from   ReSharper Essentials Make your Microsoft Visual Studio work smarter with ReSharper.

Arrow left icon
Product type Paperback
Published in Feb 2014
Publisher Packt
ISBN-13 9781849698702
Length 124 pages
Edition Edition
Arrow right icon
Author (1):
Arrow left icon
Lukasz Gasior Lukasz Gasior
Author Profile Icon Lukasz Gasior
Lukasz Gasior
Arrow right icon
View More author details
Toc

Refactoring


You will seldom work with the ideal code. Almost every code can be improved—variables or methods can have better names, and code can be better structured and less complicated. This means that you would like to refactor such code. Refactoring code is a very hard and complicated process but ReSharper makes it a bit less painful.

Let's go back to our code that was used at the beginning of this chapter and refactor it a bit.

Rename

Let's say that we would like to rename the Repository property to UserRepository. Move your cursor to the definition or usage of this property and press Ctrl + R, R, input a new name, and press Enter. ReSharper will rename all occurrences of this property.

ReSharper also checks your string values, comments, JavaScript code, and other string literals as there can be some values related to our code that should also be updated. As you can see in the following screenshot, ReSharper displays all the places that can be potentially updated and allows you to check...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image