Questions tagged [resharper-5.0]

Use this tag for version specific questions about ReSharper 5.0 - the refactoring and productivity extension for Visual Studio by JetBrains. When using this tag also include the more generic [resharper] tag where possible.

Here are highlights of some of the features in Resharper 5.0:

Code Analysis for C#
ReSharper analyzes and highlights errors in C# code (up to C# 4.0) while you type, without having to compile it first. It also helps you solve problems instantly, by suggesting quick-fixes for most errors. You can analyze your code both in a current file and throughout the entire solution. For example, in C# 3.0 Resharper will recommend using "var" for type initialization, or making a method static.

Coding Assistance
ReSharper extends and improves Visual Studio's native code completion. If you begin to use a namespace that isn't referenced, Resharper shows you a list of candidates and will automatically insert the appropriate using statement at the top of the class for you. It introduces color highlighting for fields, local variables, and types; transforms code using context actions; lets you move and duplicate blocks of code; auto-inserts brackets, parenthesis and quotes; shows concise documentation for types, type members and method parameters as pop-up tips, and more.

Code Cleanup
Code Cleanup enables you to run a dozen useful ReSharper features at once — specifically, reformat your code according to custom style settings, arrange usages of 'this' qualifier, remove code redundancies, convert properties with backup fields to auto-properties, make fields read-only if possible, optimize using directives, shorten qualified references, update file header, replace explicit types with vars, and revamp your code with many more settings.

Code Generation
ReSharper is smart enough to generate method stubs from usage, and feature-rich enough to provide special-purpose dialog boxes for creating constructors, read and write properties, and more. All these classy tools are readily accessible from a single pop-up window.

Code Templates
You can use a rich set of predefined code templates as well as define your own templates to automatically create loops, arrays, variables, method declarations, and a variety of other code constructs. File templates, 'surround with' templates and live templates for C#, VB.NET and XML let you choose the most convenient way of inserting a ready piece of code in any situation.

Navigation and Search
Whenever you need to find a certain type, field, method, or any other symbol, ReSharper provides you with a variety of ways to do it. You can find a symbol by name, navigate to a symbol declaration from its reference in code, or find and highlight symbol usages. ReSharper also allows you to thoroughly review type hierarchies and file structures, with its dedicated tool windows that are smartly integrated into Visual Studio user interface.

Refactoring
ReSharper provides a much wider set of automated code refactorings than Visual Studio. In total, 34 different refactorings are available.

Unit Testing
ReSharper automatically detects whether your project contains NUnit tests. It allows you to run and profile unit tests right from the code editor, shows the structure of tests in your solution, and provides you with a dedicated window where you can analyze test results and re-run unit tests. Support for other test frameworks (MbUnit, xUnit, MSTest) is available via third-party plugins.

47 questions
35
votes
2 answers

ReSharper and auto closing parentheses

Is there a way to avoid closing the following parentheses: String.Format(), or Console.WriteLine() automatically? Sometimes is this is annoying and unnecessary, and I end up pressing Delete to remove it. I tried disabling Auto-insert pair brackets,…
Oscar Mederos
  • 29,016
  • 22
  • 84
  • 124
31
votes
3 answers

How do I tell ReSharper that an attribute means that a method is used?

I'm playing with SpecFlow, and ReSharper thinks that my step definitions are unused (I guess because they're used via reflection): [Binding] public class StepDefinitions { // ... [When(@"I press add")] public void WhenIPressAdd() //…
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
12
votes
4 answers

Difference between these two ways of localizing a string in an aspx/ascx file?

When I started localizing a website the first time, I just did the localization like this: <%= Resources.ResourceFile.ResourceName %> and it seems to work perfectly fine. However, the ReSharper 5.0 Beta does it like this:
Brandon
  • 68,708
  • 30
  • 194
  • 223
11
votes
2 answers

How to get Resharper to convert back to a foreach loop

Resharper 5 can convert my foreachloops to Linq queries. Which I like. But linq is way way way harder to debug than a foreachloop. When I convert my foreach statement to a linq query, I don't see any option to go back the other way. Does any one…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
10
votes
3 answers

Is it possible to sort code via Resharper?

CodeRush has this nifty plugin called cr_ClassCleaner that allows me to sort the elements in the class (e.g. methods, private variables, etc...). Can Resharper 5.x do this, either via the product or plugins?
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
10
votes
5 answers

If I turn off ReSharper 5's IntelliSense, what am I missing?

During my trial of ReSharper 5, I noticed its version of IntelliSense falls behind Visual Studio 2010's in three ways that were key to me: ReSharper doesn't support IntelliSense in the "QuickWatch..." debugger utility. ReSharper's IntelliSense…
user403830
  • 907
  • 1
  • 6
  • 11
8
votes
3 answers

How to find code which is only called by tests

Occasionally I am looking at some code, I search for usages of a method (using resharper) and find that it is only called by tests. So it's effectively redundant and I can delete it and the methods that call it. Obviously there's no point in having…
Jonny Cundall
  • 2,552
  • 1
  • 21
  • 33
8
votes
5 answers

Unable to see resharper pop-ups for Ctrl-N and other similar commands

I'm not able to see the resharper pop-ups for Ctrl+N, Ctrl+Shift+N and other similar commands but other resharper shortcuts work fine - rename, stack explorer, run unit tests etc... Using Resharper 5.0 beta. Tried uninstalling and re-installing as…
7
votes
4 answers

What resharper 5 patterns do you use?

As resharper 5 now has DIY patterns, what patterns have you writen that fix coding idioms that you've seen? Is there an online resharper pattern repository? I thought here would be a logical place to vote for your favorite patterns. I think of this…
Squirrel
  • 1,355
  • 2
  • 16
  • 25
7
votes
1 answer

C# how to treat Resharper errors as compile errors in msvs 2010?

I want to treat resharper 5.0 error "Possible NullReference Exception" as MSVS 2010 compile error. Is it possible?
6
votes
2 answers

Prevent Resharper "Possible Null Reference Exception" warnings

Let's say I have an interface with a read-only property and and a concrete class where the property is instantiated in the constructor and marked as read-only. internal interface IExample { ObservableCollection Items { get;…
bryanbcook
  • 16,210
  • 2
  • 40
  • 69
5
votes
3 answers

How can I tell ReSharper to stop creating readonly fields?

This question is similar, but my question seems to get asked in an unanswered comment. I create a C# class. I use alt-insert to add a constructor. I add an argument to the constructor, and then I use alt-enter to create and initialize a field from…
Chris Farmer
  • 24,974
  • 34
  • 121
  • 164
5
votes
4 answers

Resharper 5.0 - initial impressions

Now that VS 2010 is officially released, I'm thinking of upgrading to Resharper 5.0 and I just wondered if any of you could provide any feedback on your impressions so far. Some specific questions: I like Resharper a lot, but it's pretty slow if…
dcp
  • 54,410
  • 22
  • 144
  • 164
5
votes
1 answer

C# .Net 4.0 mscorlib contains ReadOnlyDictionary?

I need a ReadOnlyDictionary. All posts told me that there is none in .Net 4.0. For that reason I created my own implementation. After doing that Resharper 5.1 told me about an ambiguous reference to System.Collections.ObjectsModel.ReadOnlyDictionary…
Sebastian Schumann
  • 3,204
  • 19
  • 37
4
votes
1 answer

Switch from Resharper 5 Intellisense to Visual Studio Intellisense using a command

Is it possible to go to Resharper -> Options -> IntelliSense -> General and switch from Resharper to Visual Studio using a command in Resharper 5? I would like to benefit from the Razor Intellisense which comes with ASP.NET MVC 3 RC but Resharper…
Pan Robal
  • 43
  • 3
1
2 3 4