Questions tagged [resharper]

ReSharper is a refactoring and productivity extension by JetBrains that extends native functionality of Microsoft Visual Studio versions since 2003.

ReSharper is a productivity tool for Visual Studio that aims to improve the developer experience. Providing additional features for error correction, code completion, navigation, search, syntax highlighting, formatting and cleanup, code generation and optimization, it carries out a large number of automated refactorings and streamlines unit testing using NUnit, MSTest, xUnit.net, MSpec (via plugin), amongst other features (all without the need to compile).

Current ReSharper releases support Visual Studio 2010-2019; previous versions supported Visual Studio 2003-2008.

ReSharper currently supports C#, VB.NET, ASP.NET, ASP.NET MVC, Razor, TypeScript, JavaScript, CSS, HTML, XML, XAML, MSBuild and NAnt build scripts.

ReSharper's functionality can be significantly extended with its Open API. In fact, most of ReSharper's features are implemented using this same API that is available in ReSharper plugins.

4908 questions
4
votes
1 answer

How to extract common/similar code blocks to function in Visual Studio C#

I want to select code, e.g. doSomething(myEnum.firstThing) doSomethingElse(myEnum.firstThing) evenMoreStuff(myEnum.firstThing) and convert it to a function GroupCommonStuf(myEnum.firstThing) which would look like: GroupCommonStuff(myEnum id) { …
4
votes
3 answers

Resharper region options on Alt+Insert

How can I set Resharper to wrap, say, the generated equality members with regions when selected from the Alt+Insert menu? Thanks
reshefm
  • 6,017
  • 8
  • 36
  • 40
4
votes
2 answers

Change access modifiers in Resharper generated auto-properties

Resharper provides a feature to create and initialize an autoproperty from a constructor parameter. By default, the generated property is of the form: public int Foo { get; set; } Is it possible to modify the accessors to have this…
4
votes
0 answers

Resharper: Customize 'Create and initialize auto-property' - private setter

When creating matching properties for constructor parameters, I mostly want the setters to be private. With out-of-the-box functionality in Resharper, the contextual 'Create and initialize auto-property "NNN"' does create a property with both the…
larsw
  • 3,790
  • 2
  • 25
  • 37
4
votes
2 answers

Find all occurrences of object instantiation

I'm developing a C# Mono project (in Unity3D) which is using an older version of the garbage collector. Memory leaks have been an unpleasant wake-up call for me. Because of this I am optimizing as much as I possibly can: avoiding Linq like the…
Vesuvian
  • 697
  • 1
  • 7
  • 22
4
votes
2 answers

C# NullReference Exception and ReSharper suggestion

This is what I have written: if ((lstProperty[i].PropertyIdentifier as string).CompareTo("Name") == 0) Resharper put me an error (I am new with ReSharper... I am trying it) and it suggests me : if (((string)…
Patrick Desjardins
  • 136,852
  • 88
  • 292
  • 341
4
votes
1 answer

How to do TDD in Visual Studio that separates production code from test code

In a typical Java IDE (say Intellij), working Test Driven Development (TDD) style mean a very efficient workflow and virtually no modifications or alternations are needed after you finish the code through the test. Java projects, just as C#…
gurun
  • 134
  • 11
4
votes
1 answer

Is there a way of extracting a selection into a partial or another view either in VS 2013 Editor or Resharper?

Is there a way of selecting HTML or razor code in the VS Editor and extract it into a separate view file? Visual Studio 2013 already has a similar feature in WebForms where code selection can be extracted into a UserControl. Also, RubyMine,…
ATL_DEV
  • 9,256
  • 11
  • 60
  • 102
4
votes
1 answer

How do you reset the ReSharper Code Inspection Settings in Visual Studio 2013?

I have R# ReSharper 8 and Visual Studio 2013. I turned off some Code Inspection Settings that I want on. Instead of trying to figure out which setting I turned off, I would like to just reset them to their default values. How is that done?
user3186206
4
votes
1 answer

Extracting a parent class from a group of classes using Reshaprer

I have a large set of auto generated classes which share about 90% of their properties. Is there a way using Visual Studio or Resharper to extract all the common properties into a parent class and make all the classes descend from the parent?
jcvandan
  • 14,124
  • 18
  • 66
  • 103
4
votes
2 answers

Resharper live templates in sql files

I created live template for creation of a stored procedure and I set availability in *.sql files. But when I'm in SQL file I don't have possibility to use live template by typing live template shortcut. I know that I have to change some setting in…
y0j0
  • 3,369
  • 5
  • 31
  • 52
4
votes
2 answers

Does the ReSharper unit test runner run tests sequentially or in parallel with MbUnit?

Does the ReSharper unit test runner run tests sequentially or in parallel (and then, is each test in a separate thread)? I am using MBUnit test framework.
Kostas
  • 303
  • 1
  • 3
  • 6
4
votes
2 answers

Resharper, ICloneable and never null

Resharper complains about the following code, saying that the last null check is redundant as the 'expression is always false': ICloneable data = item as ICloneable; if (data == null) throw new InvalidCastException("blah blah, some error…
David Rutten
  • 4,716
  • 6
  • 43
  • 72
4
votes
1 answer

Can vsvim map keys to ReSharper.ReSharper_ExtendSelection?

I have these maps in my .vsvimrc and they work as expected. I presss z followed by / or Shift+/ and comments are added. map :vsc ReSharper.ReSharper_LineComment map :vsc ReSharper.ReSharper_BlockComment These do not work. map…
Josh Buedel
  • 1,853
  • 16
  • 41
4
votes
2 answers

Should I use both NotNull and ContractAnnotation("null => halt")?

It seems that NotNull and ContractAnnotation("key: null => halt") are fairly similar in their effect on R#. Is there something that I am missing? Should I always apply both?
Den
  • 1,827
  • 3
  • 25
  • 46