resharper

Use “convert to auto property” on multiple properties at once

丶灬走出姿态 提交于 2019-11-29 07:41:20
I find myself using Resharper's "convert to auto property" refactoring a lot to remove pre C# 3.0 boilerplate code. Is there a way I can apply this to all properties in a single class at once? The ReSharper can do this: Options -> Code Cleanup -> Use auto-property, if possible Run code cleanup for the class - and you should be done. Tanascius has the right answer, though you can tweak that a little bit by creating your own custom Code Cleanup script that would ONLY include the "Use auto-property if possible" refactoring. That would probably be preferable if you didn't want the rest of the

Use “convert to auto property” on multiple properties at once

夙愿已清 提交于 2019-11-29 07:28:37
I find myself using Resharper's "convert to auto property" refactoring a lot to remove pre C# 3.0 boilerplate code. Is there a way I can apply this to all properties in a single class at once? The ReSharper can do this: Options -> Code Cleanup -> Use auto-property, if possible Run code cleanup for the class - and you should be done. Tanascius has the right answer, though you can tweak that a little bit by creating your own custom Code Cleanup script that would ONLY include the "Use auto-property if possible" refactoring. That would probably be preferable if you didn't want the rest of the

State of Jasmine Unit Test support of Resharper 2017: Debug mode and AMD modules supported?

一笑奈何 提交于 2019-11-29 07:26:54
I currently use Chutzpah to run and debug Jasmine Unit tests that include AMD/require.js modules. I would like switch to the test runner of Resharper 2017. However, Resharper does not seem to fully support Jasmine Unit Tests? A. Example jasmine test: /// <reference path="../../bower_components/requirejs/require.js" /> /// <reference path="../../bower_components/jasmine-core/lib/jasmine-core/jasmine.js" /> describe('dummy example test', function() { it("should return bar", function () { expect(true).toEqual(true); }); }); The Test can be run with Resharper but the Debugging option is disabled:

Is there a way to keep ReSharper from formatting a region of code

夙愿已清 提交于 2019-11-29 05:53:06
I use ReSharper's code cleanup all the time, but sometimes I have code formatted in a way that makes it easier to read than ReSharper's formatter makes it. Is there a way to mark part of your file with comments or something to make it skip formatting that portion. (I'm not talking about inspections, I know how to have ReSharper ignore regions for inspections) I had a discussion with Resharper support about this, their answer: Thank you very much for this information! We will discuss if we can support such formatting style in one of the future versions. Probably not, but you can try writing

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

Can Visual Studio tell me which reference threw a NullReferenceException?

前提是你 提交于 2019-11-29 03:59:28
I'm writing unit tests for an MVC web app, and I've been getting null reference exceptions because the mocked-up test objects are only partly initialized. I know which line is throwing the exceptions, and it looks something like this: return Supervisor.RegistrationInformation.Registrations .Any(r => r.RegistrationCountry.IsUSAOrCandada() && (!DatesWorked.Start.HasValue || r.RegistrationDate <= DatesWorked.Start.Value) && (!DatesWorked.End.HasValue || r.RegistrationExpirationDate >= DatesWorked.End.Value) && //... There are a lot of references in there, and any of them could be the problem.

Is there a resharper comment directive to disable code cleanup for a class?

空扰寡人 提交于 2019-11-29 03:36:33
I have a class where FileHelpers is dependent on the field order in this class file. If the class file ever gets a code clean up run against it that will cause the fields to be sorted alphabetically and invisibly ruin my class. Since I would like to avoid this from ever accidentally occuring, is there a resharper comment directive to disable code cleanup for a class? Romain Verdier You can customize the default member layout XML file and specify a pattern you want to ignore during the "reorder members" step of a code cleanup. Have a look at the Type Member Layout section under the Resharper

How do I make my own method similar to String.Format using Composite Formatting in C#

南楼画角 提交于 2019-11-29 03:00:48
I like how String.Format uses arguments to inject variables in to the string it is formatting. This is called Composite Formating and is discussed by MSDN here . I want this functionality with my logging facade: string foo = "fancy"; string bar = "message"; log.Debug("My {0} log {1}.", foo, bar) My ILoggerFacade has the following method signature: void Debug<T>(T message, params Object[] args); And, I know I can implement this quite simply: ILog m_Log = \\some logging implementation public void Debug<T>(T message, params Object[] args) { m_Log.Debug(String.Format(message, args)); } However, in

Coderush and resharper, do they work together?

早过忘川 提交于 2019-11-29 02:57:23
问题 anyone have any experience of using them together? How well does it work? or is it just too much grief? 回答1: You don't want to do that. Both ReSharper and CodeRush want the keyboard. Specifically, CodeRush remaps the escape key (ESC) for its own purposes. ReSharper does not like that (note: ReSharper doens't do anything special with the escape key, but it still doesn't like it). As for choosing between them...they both have their points. CodeRush has better templating and more refactorings.

Using a class's static member on a derived type?

♀尐吖头ヾ 提交于 2019-11-29 01:22:11
问题 Using Resharper 4.1, I have come across this interesting warning: "Access to a static member of a type via a derived type". Here is a code sample of where this occurs: class A { public static void SomethingStatic() { //[do that thing you do...] } } class B : A { } class SampleUsage { public static void Usage() { B.SomethingStatic(); // <-- Resharper warning occurs here } } Does anybody know what issues there are (if any) when making use of A's static members via B? 回答1: One place where it