Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

.NET Tools How-To's

9 ReSharper Features Every .NET Developer Should Know

Around 15 years ago, I got my first assistant job at a university department. Frankly, I only used ReSharper for its solution-wide analysis, which would alert me whenever I broke the spaghetti code I got served. I did not know about all the refactorings yet. It was only at my second job that my awesome team lead (Fabian 👋) taught me about all the niceties ReSharper had to offer. Eventually, we even extended it with custom live template macros. What a memorable time. 🥹

To this day, I consider ReSharper an indispensable Visual Studio extension that helps developers be more productive. Let me take you on a journey through my top nine ReSharper features!

1. Initial Letter Search

Navigation in ReSharper is not just about a single shortcut and wildcard text search on different syntax elements. The initial letter search helps you to avoid typing out long parts of a searched element by using camel-humps; typing a . gives you a quick look at the type’s members. All results are shown in a clean, highlighted, and compact way:

Goto Everything with Initial Letter Search
Goto Everything with Initial Letter Search

It even works a bit fuzzy, for example, TupleNames is shown when you search for NT (not TN). This allows you to find what you’re looking for, even if your input isn’t exact, whether it’s a typo or a fuzzy memory.

2. Contextual Navigation

Besides regular search-term-based navigation, ReSharper also provides a growing number of contextual navigation actions. After you’ve placed the caret on an element, you can invoke Navigate To and explore more specific items:

Navigate To Context Menu
Navigate To Context Menu

One of the most recent additions is Related Tests/Subject, but you can also find old and familiar friends, like Consuming/Exposing APIs, Extension Methods, Show Usages, or Decompiled Sources. Note that all actions have the assigned shortcut shown next to them for your skill progression!

3. Recent Locations and Changes

Statistically, a large part of our work concerns reading and navigating code. Only after we understand the surrounding bits can we confidently implement new features. Switching between reading and writing becomes essential, and ReSharper makes it effortless and targeted with the following actions:

Goto Recent Edits Pop-up with Filtering
Goto Recent Edits Pop-up with Filtering

Once you start typing in these pop-ups, you can further filter the results. For many developers, these actions have made searching through editor tabs obsolete. Does anyone know an extension to completely hide them?

4. Extend Selection

As a developer, I often see my peers rely on the mouse to select text, which is rather inefficient and often imprecise. With the Extend Selection action, you can successively select the next higher logical block of code from your original caret position. Shrink Selection travels the selection stack backwards:

Extend Selection and Shrink Selection in Action
Extend Selection and Shrink Selection in Action

The feature – similarly to Structural Navigation – relies on the concept of abstract syntax trees with small modifications to make it more useful and predictable. Both act as the groundwork for follow-up refactorings, like Introduce Variable or Extract Method, by allowing an accurate selection. They also enable the structural remove feature, which removes remaining whitespaces and utility characters around your selection. For instance, to turn Type<TInput, TOutput> into Type<TInput> just by removing TOutput.

5. Move Code Up/Down/Left/Right

Rearranging code is common practice, but cut-and-paste is a provisional solution that often requires manual fixes. ReSharper lets you move code at the structural level, preserving logic and context. For example, you can reorder statements naturally, even across multiple lines:

Move Code on Different Syntax Elements
Move Code on Different Syntax Elements

Greedy brace on compound statements, like if or using statements, is another way to quickly adjust block scopes. I use Move Left/Right mainly to reorder expression operands, collection elements, or parameters/arguments. Our exhaustive list of applicable cases even revealed a few surprises for me. Fun fact, I always forget the shortcuts when I’m being watched during demos. 😅

6. Migrating to the Latest C#

Every year, we get a new box full of valuable C# language features – thanks, Mads Torgersen and the C# language team! As developers, we want to integrate them efficiently across the codebase. With ReSharper’s inspections, quick-fixes, and context actions, you can confidently modernize code not only in a single spot but also at solution/project/file scope:

Applying Quick-Fixes in Solution Scope
Applying Quick-Fixes in Solution Scope

Many developers rely on ReSharper’s suggestions to discover and adopt new C# features. Personally, I might depend eternally, since I rarely get my pattern matching right on the first try. 😉 For more language support that improves readability, code quality, bug prevention, and performance, take a look at some of our previous blog posts:

7. Postfix Templates

This is the ace up my sleeve to teach even seasoned users of ReSharper something new during presentations. Postfix templates allow you to perform complex transformations via special completion items that look like instance methods.

Various Postfix Templates in Action
Various Postfix Templates in Action

Definitely check out the growing list of postfix templates. My personal favorites are collection.foreach, Type.new, and expression.var. With our latest additionservice.inject – we pushed the imaginable a little further!

8. Configuration of Code Style and Formatting

A consistent code style/formatting eliminates unnecessary friction in reading and working with your code. However, configuring it through text files is probably not the most enjoyable task. ReSharper provides a visual editing experience to adjust code style for a selected fragment or to detect rules from code with the desired look:

Dialog with Detected Code Style Settings
Dialog with Detected Code Style Settings

You can store and share formatting rules in a number of formats with the Save To button, including .editorconfig. A largely underrated feature is the Save As Comments button, which adds formatter instructions that are only valid for the selection. For instance, you might not always want to align code in columns, but occasionally it can be very useful. And – pssst 🤫 – you can also troubleshoot formatting settings with ease.

9. Project- and File-Level Refactorings

Visual Studio’s context menu in the solution explorer is kinda bloated, but if you look close enough – or hit Ctrl-Shift-R – you can find some really beneficial large-scale refactorings that save you plenty of time:

Various Solution-Level Refactorings
Various Solution-Level Refactorings

Who wants to deal with file creation during prototyping? Who wants to adjust all those namespaces when you clean up your project structure by moving files into different folders? Right, ReSharper wants to do that for you! 😆 And, by the way, you should really check out the recently introduced Convert Usings to Global refactoring.

Honorable Mentions

You probably know how these Top X in Y blog posts turn out. There’s way too much, and we could go on forever. So, in the interest of your time and keeping the title SEO friendly 🤖, here are a few more highlights for you to learn about:

Conclusion

I hope that every single one of you has learned something new about ReSharper. What’s your favorite ReSharper feature? Please let me know in the comments!

image description