resharper

C# 'var' keyword versus explicitly defined variables [duplicate]

一曲冷凌霜 提交于 2019-11-26 20:21:49
问题 This question already has an answer here: Use of var keyword in C# 86 answers I'm currently using ReSharper's 30-day trial, and so far I've been impressed with the suggestions it makes. One suggestion puzzles me, however. When I explicitly define a variable, such as: List<String> lstString = new List<String>(); ReSharped adds a little squiggly green line and tells me to: Use implicitly type local variable declaration. If I then follow its suggestion, ReSharper changes the line of code to: var

How do I generate a constructor from class fields using Visual Studio (and/or ReSharper)?

我们两清 提交于 2019-11-26 19:44:07
I've gotten accustomed to many of the Java IDEs ( Eclipse , NetBeans , and IntelliJ IDEA ) providing you with a command to generate a default constructor for a class based on the fields in the class. For example: public class Example { public decimal MyNumber { get; set; } public string Description { get; set; } public int SomeInteger { get; set; } // ↓↓↓ This is what I want generated ↓↓↓ public Example(decimal myNumber, string description, int someInteger) { MyNumber = myNumber; Description = description; SomeInteger = someInteger; } } Having a constructor populate all of the fields of an

Test method is inconclusive: Test wasn't run. Error?

一曲冷凌霜 提交于 2019-11-26 19:03:47
问题 I have a test class and below I have posted a sample test from the test class namespace AdminPortal.Tests.Controller_Test.Customer { [TestClass] public class BusinessUnitControllerTests { private IBusinessUnitRepository _mockBusinessUnitRepository; private BusinessUnitController _controller; [TestInitialize] public void TestInitialize() { _mockBusinessUnitRepository = MockRepository.GenerateMock<IBusinessUnitRepository>(); _controller = new BusinessUnitController(_mockBusinessUnitRepository);

How do you find all implementations of an interface?

不羁岁月 提交于 2019-11-26 18:47:56
Suppose you have an interface defined in C#. What is the easiest method to find all classes that provide an implementation of the interface? The brute force method would be to use "Find References" in Visual Studio and manually look through the results to separate out the usages from the implementations, but for an interface in a large codebase that is heavily referenced with relatively few implementations, this can be time consuming and error prone. In Java, running javadoc on the codebase (using the -private option to include private classes) would generate a documentation page for the

Keyboard shortcuts are not active in Visual Studio with Resharper installed

痴心易碎 提交于 2019-11-26 18:45:49
问题 I have Visual Studio 2012 + Resharper 7.1.1000.900 + StyleCop 4.7.44 installed. The problem is that no shortcuts are active since Resharper was installed. For example: I can rename via 'Refactor > Rename'. But shorcut Ctrl + R does nothing. I've set Resharper keyboard scheme to 'Visual Studio' in 'Resharper > Options > Environment > Keyboard & Menus' Is there any way to activate shortcuts? Thanks. 回答1: I would first try resetting all Visual Studio settings ( Tools > Import and Export Settings

Should these arguments be added or removed?

怎甘沉沦 提交于 2019-11-26 18:34:18
问题 When Resharper argues with itself, how does one know which persona to give more credence? I think I have found some code that does confuse Resharper (this is apparently a very unusual case - after using it for a day, I think Resharper is the bee's knees/the greatest thing since liquified bread, etc.). With this line of code: ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16)); Resharper tells me to "add argument name 'rgbkey'" and then

How can I disable ReSharper in Visual Studio and enable it again?

落花浮王杯 提交于 2019-11-26 18:05:00
I installed ReSharper , and it works in Visual Studio, but how can disable it? Whenever I search in the ReSharper menu I can't find a disable option. Matthew Perron You can disable ReSharper 5 and newer versions by using the Suspend button in menu Tools -> Options -> ReSharper . Oscar Mederos If you want to do it without clicking too much, open the Command Window ( Ctrl + W , A ) and type: ReSharper_Suspend or ReSharper_Resume depending on what you want. Or you can even set a keyboard shortcut for this purpose. In Visual Studio, go to Tools -> Options -> Environment -> Keyboard . There you can

How to extend IntelliSense items?

旧巷老猫 提交于 2019-11-26 16:54:15
问题 I would like to manually extend the IntelliSense list by various items. I want to be responsible for the action triggered by the item (i.e. code completion and tooltip info). It doesn't matter what items. Is this possible with an VisualStudio add-in, ReSharper / DXCore or any otherg plugin? Background: Some of you may know FOP (feature-oriented programming). FOP would require various changes to intellisense and editor behavior. Edit: Another interesting post. 回答1: This is definitely doable

Visual Studio 2005 Intellisense stopped working after ReSharper installation

こ雲淡風輕ζ 提交于 2019-11-26 16:33:26
问题 I installed the ReSharper evaluation version and uninstalled it. Afterwards Visual Studio's Intellisense stopped working. I have restarted computer but I still have this problem. Can anyone please help me here? I am using Visual Studio 2005. Thanks. 回答1: Try opening Visual Studio Command Prompt and entering: devenv.exe /ResetSettings 回答2: Try going to Tools > Options > Text Editor > C# and checking all of the options under Statement completion. I think Resharper disables these upon

Why does ReSharper want to use &#39;var&#39; for everything?

南笙酒味 提交于 2019-11-26 15:52:59
I've just started using ReSharper with Visual Studio (after the many recommendations on SO). To try it out I opened up a recent ASP.NET MVC project. One of the first and most frequent things I've noticed it suggesting is to change most/all my explicit declarations to var instead. For example: //From This: MyObject foo = DB.MyObjects.SingleOrDefault(w => w.Id == 1); //To This: var foo = DB.MyObjects.SingleOrDefault(w => w.Id == 1); and so on, even with simple types such as int , bool , etc. Why is this being recommended? I don't come from a computer science or .NET background, having "fallen