resharper-5.0

How to get Resharper to convert back to a foreach loop

妖精的绣舞 提交于 2020-02-03 03:46:06
问题 Resharper 5 can convert my foreach loops to Linq queries. Which I like. But linq is way way way harder to debug than a foreach loop. 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 know how to do this? Is it even possible? 回答1: We are working on LINQ2Foreach (and some other) functionality for ReSharper vNext 回答2: I do not believe this is possible. Certainly, it's not listed in the examples of Quick Fixes, where loop-to-LINQ

Can I search by a reference name, solution-wise, to see in which projects it was referenced?

与世无争的帅哥 提交于 2019-12-24 06:36:23
问题 Is there any possibiliy to searh the whole solution to see a particular refrence's usage? Let's say, can I see in what projects the reference "Xyxyxyxy.dll" is referenced? (ReSharper based answers are also acceptable! :) ) Thanks! 回答1: You can do this through notepad++ quite easily by giving the solution directory and *.csproj as the filter i.e. searching the csproj files for the references. In case you want to search for GAC assembly references, search for the following string <Reference

Prevent Resharper “Possible Null Reference Exception” warnings

十年热恋 提交于 2019-12-22 05:38:50
问题 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<string> Items { get; } } internal class Example : IExample { private readonly ObservableCollection<string> _items; public Example() { _items = new ObservableCollection<string>(); } public ObservableCollection<string> Items { get { return _items; } } } When I use the interface Resharper

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

南笙酒味 提交于 2019-12-07 00:51:30
问题 I want to treat resharper 5.0 error "Possible NullReference Exception" as MSVS 2010 compile error. Is it possible? 回答1: Update , since it seems people are still finding this answer: This, or something very much like it, is possible today with e.g. StyleCop Analyzers. There's a whole bunch of analyzer tools which you can plug into the .NET compiler platform - I recommend checking out the DotNetAnalyzers GitHub org, as well as (of course) the home of the .NET compiler platform itself. Original

Prevent Resharper “Possible Null Reference Exception” warnings

被刻印的时光 ゝ 提交于 2019-12-05 08:14:31
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<string> Items { get; } } internal class Example : IExample { private readonly ObservableCollection<string> _items; public Example() { _items = new ObservableCollection<string>(); } public ObservableCollection<string> Items { get { return _items; } } } When I use the interface Resharper warns me that I might have a possible null reference in calling code. public class ExampleWithWarnings

ReSharper and auto closing parentheses

余生长醉 提交于 2019-11-30 06:14:31
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, pharentheses and quotes and Auto-insert closing brace and it is still not working... The following options should be unchecked/checked in Resharper if you do not want autocomplete feature on parenthesis (all options can be accessed through Visual Studio > ReSharper > Options... > Environment ) To disable parenthesis auto insert in non method

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

╄→尐↘猪︶ㄣ 提交于 2019-11-29 10:49:06
问题 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() // R# thinks this is unused { _calculator.PressAdd(); } // ... } How can I tell ReSharper that methods with [Given] , [When] , [Then] attributes (etc.) are actually used? I don't want to use // ReSharper disable UnusedMember.Global comments. I could also mark each

ReSharper and auto closing parentheses

别说谁变了你拦得住时间么 提交于 2019-11-29 05:00:29
问题 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, pharentheses and quotes and Auto-insert closing brace and it is still not working... 回答1: The following options should be unchecked/checked in Resharper if you do not want autocomplete feature on parenthesis (all options can be accessed through