resharper

Compare string to null - Why does Resharper think this is always false?

徘徊边缘 提交于 2019-12-04 18:41:26
问题 I have this code in my custom MembershipProvider: public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { if (config == null) throw new ArgumentNullException("config"); if (name == null) name = "MyCustomMembershipProvider"; ... } Resharper marks the second if-Statement and tells me, it would always evaluate to false. But why would this always evaluate to false? I could easily pass null to the method as a parameter. Is this a bug or is

Visual Studio: Missing Ctrl+O+O, Ctrl+T Eclipse analog

末鹿安然 提交于 2019-12-04 17:46:11
I very like Eclipse Ctrl + O + O hotkey which includes in the list of members not only members of current class, but also all the members of all super-classes. "Quick type hiererchy" feature also is pretty useful. Resharper has Alt + End and Alt + Home keys, but it doesn't organize result in a tree what is very handy. Is it possible to get mentioned functionality in VS? Jura Gorohovsky ReSharper provides the Type Hierarchy window (ReSharper > Inspect > Type Hierarchy) for investigating inheritance. File Structure (ReSharper > Windows > File Structure) is ReSharper's version of Outline, and it

Format Multiline code to single line in Visual Studio

断了今生、忘了曾经 提交于 2019-12-04 17:42:21
问题 Is there a keyboard shortcut or fast way to change the below code to a single line in Visual Studio 2013? I also have Resharper installed. Multi new XElement("Option", new XAttribute("Name", "FileDelete"), "1" ), Single new XElement("Option", new XAttribute("Name", "FileDelete"),"1" ), 回答1: Just select all the text and press (control + j) and it will become 1 line of code 回答2: I setup find/replace for quick use with a regex expression like so: (note: I use VS 2015, so your hotkeys may be

Visual Studio always on top when debugging

孤街醉人 提交于 2019-12-04 17:11:25
问题 When I start debugging the project we are currently working on, the program window is not given proper focus in windows but is stacked behind the Visual Studio window. I don't think this problem occurs on any of my team members computers, so it looks like it's a problem on my system. Is there a setting in VS2008 for always on top or something like that? I can't seem to find one... Any idea what could be causing this? Visual Studio? The program code? I know this is sort of a vague issue but I

Captilizing a name in a ReSharper template

断了今生、忘了曾经 提交于 2019-12-04 16:40:09
问题 Is there a way to create a template in ReSharper that capitalizes a name? For example I'd like to do something like this: private $type$ _$name$; public $type$ $uppercase_name$ { get { return _$name$; } set { _$name$ = value; } } So when I enter " city " for $name$ , $uppercase_name$ should automatically be " City ". 回答1: Ok I did it: When adding a template, on the right there's a part where you can choose a macro. Click on " Choose Macro " for uppercase_name . Go to the end of the list.

Autocompleting initializer with Resharper 6 in Visual Studio 2010

女生的网名这么多〃 提交于 2019-12-04 16:20:09
问题 I was wondering if there is any way to shortcut the process of object initialization with VS 2010 and Resharper (6). When presented with the yellow tool tip below I'd like to have it create an assignment for each field. For instance, it would generate: Contact = ; ContactId = ; CreateDate = ; etc, etc (one for each property). 回答1: ReSharper code completion works exactly this way. As soon as you've typed in the braces, press Ctrl+Space to get the list of all properties: var data = new Data {|}

Why does IntelliSense keep changing function to Function?

那年仲夏 提交于 2019-12-04 16:05:22
问题 I am having a very strange IntelliSense issue, and I'm not sure if it's Visual Studio 2013 or ReSharper 8.1. When I'm working in views (cshtml) within script tags (javascript), something keeps changing "function" to "Function" with a capital "F." <script type="text/javascript"> var something = function() .... //on tab or completing the ()'s, it changes to Function </script> This isn't a huge deal, of course, but it's becoming a pain in my neck as I keep having to go back and lower-case the "F

How can Resharper be made aware of the framework version?

核能气质少年 提交于 2019-12-04 15:52:30
问题 I am coding in VS2008 with Resharper 4.5.1, but the projects are set to target .NET Framework 2.0. Still, Resharper is making suggestions that are relevant to the .NET 3.5 framework. For instance, it tells me that I should be using collection initializers, etc... I've looked through the settings and can't seem to find the checkbox to tell it to give 2.0 specific advice. 回答1: Select your project in the Solution Explorer and open the Properties tool window ( F4 in the standard keyboard layout

Resharper marks my NUnit tests as unused

扶醉桌前 提交于 2019-12-04 15:34:28
I'm using Visual Studio 2008 and NUnit 2.6.3 together with Resharper 8.2 Resharper recognizes my Unit tests (so I can run them with Resharper) but yet they are all marked as unused (classes as well as the individual test methods). I know how to suppress the warning with a comment at each test class but I am looking for a solution without such comments because they also affect test code that is really unused (and thus I should be warned). From my understanding this should work out of the box for NUnit tests but I can't manage to make it work. Do I have to change some settings? I googled quite a

How to disable undesirable auto-complete with Visual Studio + ReSharper?

半世苍凉 提交于 2019-12-04 15:20:04
问题 I'm using Visual Studio 2010 and ReSharper 5. I define this at the top of a .cs file. #if X86 using size_t = System.Int32; #else using size_t = System.Int64; #endif Then I can use size_t and know that it is a native integer, 32 bits if compiled as a 32 bit assembly, and 64 bits if compiled as a 64 bit assembly. (for those that are curious, the alternatives are always use Int64, or branch at runtime on IntPtr.Size == 4 and have two versions of the code. I prefer this solution.) However, if I