resharper

Formatting Resharper backing fields for properties in C#

久未见 提交于 2019-12-22 03:43:31
问题 So this is a follow-up to Keith Nicholas' question from 2 years ago: Formatting Resharper backing fields for properties in C# My guess is this would probably involve a custom Type Members Layout. Is there a way to to this yet in the latest Resharper version (as of now, it's 5.1) yet? 回答1: Version 9.1 has a new option: Resharper > Options > Code Editing > Place backing field above property https://youtrack.jetbrains.com/issue/RSRP-411980#comment=27-961304 回答2: In Resharper 6.1 I have this kind

How to get Resharper to use Visual Studio's snippets

狂风中的少年 提交于 2019-12-22 02:04:31
问题 I installed Resharper in VS2008 and it seems to have taken over some of the snippets I've come to rely on. For instance, prop, foreach, etc... How can I tell Resharper to let VS2008 use its own snippets or at least not to overwrite snippets that already exist. Better yet, is there a way to selectively tell Resharper which snippets it can overwrite and which it shouldn't? I know about the Live Templates menu item that lets you pick and choose, but after deselecting 'foreach', for example, VS

Code is heuristically unreachable

不想你离开。 提交于 2019-12-22 01:47:15
问题 What does this mean in contrast to "unreachable code detected"? 回答1: Heuristically unreachable means possibly unreachable code. Unreachable code is certainly unreachable. 回答2: Here's an example of Resharper giving the cryptic "Heuristically unreachable code" warning: It's an example of: Resharper being way to smart for itself, because if you remove it the compiler will complain about a lack of a return statement Use of a word that is not common lexicon 回答3: Say you're deleting 2 different

How to debug in Visual Studio with NSpec

回眸只為那壹抹淺笑 提交于 2019-12-21 19:45:27
问题 how do I debug in visual studio with NSpec? I've resharper installed I need to step into my test code. 回答1: At least in Visual Studio 2013, the NSpec Test Adapter (by {o} Software) seems to do the trick. Find it in the Extensions gallery. Then just right-click on the test in the Test Explorer and hit Debug. 回答2: Another good option is to just type System.Diagnostics.Debugger.Launch() in the test you want to debug. You'll get a Visual Studio prompt to debug the test. I would also recommend

C# - Can't find usage of method when inherited and used through an interface implemented by the subclass

妖精的绣舞 提交于 2019-12-21 12:54:36
问题 I'm using VisualStudio 2008 and 2010, both with ReSharper, and when I try to lookup for usages of a given method I get no results, despite the method being inherited and then called through an interface. What's wrong? Is that a VS/ReSharper bug? See the example below: using System; namespace UsageNotFound { interface MyInterface { void Hello(); } class SuperClass { public void Hello() //NOTE: VS 2008/2010 (with resharper) seems unable to find usages on this!!! { Console.WriteLine("Hi!"); } }

How to convert a C# object initializer to use a constructor using Resharper structural find and replace

╄→гoц情女王★ 提交于 2019-12-21 12:30:02
问题 I want to use a Resharper structural search and replace template to automatically replace examples of this: new Fruit { Name = "Apple", IsTasty = true } With this: new Fruit("Apple", true) (Note, the required constructor already exists) I've tried various combinations like this: new $type$ { Name = $name$, IsTasty = $isTasty$ }; ...using various different Placeholder types, but R# doesn't find any of the examples in my code. Has anyone done this before? 回答1: So I just did this in resharper (9

How to register custom html tags in Resharper?

房东的猫 提交于 2019-12-21 12:02:47
问题 I would like to use custom tags in my html files to include custom knockout components [1]: <like-widget params="value: userRating"></like-widget> I added the tag to the VisualStudio html formatting settings: Tools > Options > Text Editor > HTML (Web Forms) > Formatting > Tag Specific Options Resharper still does not recognize the custom tag and gives the warning Cannot resolve tag "like-widget" How do I tell Resharper to allow that specific tag without disabling the unknown tag warning? Is

Resharper function to fix naming convention issues

。_饼干妹妹 提交于 2019-12-21 09:07:49
问题 A bunch of classes doesn't comply to our naming conventions for private variables. Resharper shows this as a warning, but wants me to fix all of them by hand. Is there some magic option to auto-fix these issues? 'Clean-up code' won't do anything with this. Same goes for converting properties with backing fields to automatic properties when possible: the hint is shown, but Resharper won't fix it automatically. 回答1: In more recent versions of ReSharper, this is much easier, but the solution

Resharper function to fix naming convention issues

非 Y 不嫁゛ 提交于 2019-12-21 09:07:22
问题 A bunch of classes doesn't comply to our naming conventions for private variables. Resharper shows this as a warning, but wants me to fix all of them by hand. Is there some magic option to auto-fix these issues? 'Clean-up code' won't do anything with this. Same goes for converting properties with backing fields to automatic properties when possible: the hint is shown, but Resharper won't fix it automatically. 回答1: In more recent versions of ReSharper, this is much easier, but the solution

How to prevent ReSharper from shortening namespaces when adding using directives?

你离开我真会死。 提交于 2019-12-21 07:56:08
问题 When I use ReSharper to add a using directive (using Alt+Enter) it removes "unnecessary" parts of the namespace. I prefer using the full namespace which is also the behavior of Visual Studio. Example: namespace MyCompany.MyTool.Data { // This is what ReSharper gives me: using Core; // This is what I want: using MyCompany.MyTool.Core; // ... } Which setting do I have to change in ReSharper 4.5 so it uses the full namespace? 回答1: I don't have ReSharper 4.5 installed at the moment, but in 5.0