Questions tagged [resharper]
15 questions
40
votes
8 answers
Inverting an IF statement
So I've been programming for a few years now and recently have started using ReSharper more. One thing that ReSharper always suggests to me is to "invert 'if' statement to reduce nesting".
Let's say I have this code:
foreach (someObject in…

Barry Franklin
- 613
- 1
- 5
- 12
26
votes
3 answers
Are there any benefits to removing unused using statements in a VS project?
Are there any benefits to removing unused using statements in a VS project (such as can be done using Resharper), or will VS automatically take care of that when building/deploying?

B. Clay Shannon-B. Crow Raven
- 751
- 3
- 9
- 21
13
votes
1 answer
Why does Resharper prefer "as" to "is"?
When I write code like this, where obj is a local variable:
if (obj is IMyInterface)
{
var result = (IMyInterface)obj;
// ....
}
Resharper offers to change it into code like this:
var result = obj as IMyInterface;
if (result != null)
{
//…

Dave Hillier
- 3,940
- 1
- 25
- 37
10
votes
8 answers
Variable naming conventions?
I've just started using ReSharper (for C#) and I kind of like its code smells finder, it shows me some things about my writing that I meant to fix a long time ago (mainly variable naming conventions).
It caused me to reconsider some of my naming…

Ziv
- 2,946
- 5
- 23
- 26
10
votes
2 answers
Is Resharper still a significant improvement for Visual Studio 2012
I currently use Resharper with VS 2008 Pro. I find it almost a necessity to be as productive as I can be due to lack of some of the basic refactors/shortcuts in VS.
However I was wondering if since VS 2008 improvements have been made that make it…

Mike Q
- 225
- 2
- 3
3
votes
1 answer
What development tools would you recommend for developing .NET apps in Mono that would give me the same productivity boost as Resharper?
Aside from using IDEs such as MonoDevelop, what combination of tools do you use in Mono development to give you the same productivity boost that one would normally gain by using R# in VS2010?
EDIT: I'm trying to kick the R# habit and switch to Mono…

plaureano
- 1,231
- 1
- 11
- 13
3
votes
1 answer
Why does the tool offer to change the code - just because it can?
Resharper (or is it Visual Studio - it's a yellow light bulb with a tiny red filament in it) offers to "invert if" on this code:
if (tItems >= 0)
{
return tItems;
}
SetTotalItemsAndTotalAmt();
...and if I allow it to, it becomes this:
if…

B. Clay Shannon-B. Crow Raven
- 751
- 3
- 9
- 21
3
votes
2 answers
Do you use ReSharper full time, or only enable it when needed?
Based on a multitude of questions related to temporarily disabling ReSharper, and also on certain research data, I can see that a considerable share of ReSharper users have it disabled most of the time. They tend to enable it for a limited period of…

Jura Gorohovsky
- 131
- 1
- 4
2
votes
3 answers
What is the Most Expedient Way to Make Legacy Code Conform to 'The Principle of Proximity'?
On page 242 of Code Complete 2, Steve McConnell touts The Principle of Proximity.
Put simply, Mr. McConnell advises programmers to keep related actions together.
In my case, the applicable emphasis is:
It's important to initialize and set…

Jim G.
- 8,006
- 3
- 35
- 66
2
votes
3 answers
Resharper - Benefits
Having seen a few mentions about Resharper on this site and on SO, I thought I would take a look. There seems to be a hell of a lot of documentation on their website, so I was just wondering, in a snapshot, what benefits it brings and what are the…

Darren Young
- 2,175
- 1
- 20
- 27
1
vote
2 answers
c# Is using the assertion method bad or not for clean code?
I'm reading Uncle Bob Martin's Clean Code and now I have a question about the code I wrote. Is using a method as an assertion method a good or bad practice for clean code? Example
// Simple example
public class EmployeeGateway
{
private readonly…

pampua84
- 133
- 7
1
vote
3 answers
C#6: Should I refactor my code using Resharper for the new features?
C# 6 is here for a while now and brings with it some syntactic sugar that Resharper is kind enough to highlight and recommend that I "migrate to". Should I apply these fixes automatically to the entire code base and commit? Even though this question…

ytoledano
- 281
- 2
- 9
0
votes
1 answer
Mastering the usage of [PublicAPI] attributes?
Take the following class, without [PublicAPI] attribute, ReSharper says that all public members can be made private.
using System;
using JetBrains.Annotations;
namespace ObjMtl
{
// [PublicAPI]
[NoReorder]
public sealed class…

aybe
- 727
- 6
- 16
0
votes
3 answers
What's an effective strategy to mark code as reviewed?
I am reviewing a big C# code base and thought on how to mark it as reviewed when it is, in order to not review it twice.
Currently I have a ReviewedAttribute which I use to decorate members that have been reviewed:
public class ReviewedAttribute :…

aybe
- 727
- 6
- 16
-1
votes
1 answer
What are the advantages of a $ SKU of VS2012 over Express?
I will be using Visual Studio only for creating C#/XAML Windows Store apps. Is there any reason for me to purchase a "Professional" SKU of VS 2012 rather than just using the Express (free) "Metro apps with C#/XAML" version?
The only thing I can…

B. Clay Shannon-B. Crow Raven
- 751
- 3
- 9
- 21