HowTo make some settings in ReSharper
Hi,
I used JustCode before. Now I go to ReSharper 8 and got some questions for using it with C#:
In JustCode I could use a setting: "Replace 'var' by explicit type declaration"
In ReSharper I constantly get var's, which I do not want. How could I tell ReSharper to use an explicit type in auto generated code, and to warn if a var is found?
I know that some people want var for refactoring, but...
Take code like the following:
public static class Test { public static double GetWeight() { return 10.0; } public static double GetVolume() { return 20.0; } } "SomeOtherClass" { static void Main(string[] args) { var volume = Test.GetVolume(); var weight = Test.GetWeight(); if (volume > 0) { var density = weight / volume; }...
With a review of "SomeOtherClass" you cannot tell that the comparision to zero is not good for double. (for reviews often a text with beamer is used..) If somebody refactors the Test class to use int, you will get a zero density. So if you want to do something with a density >0, you will for a long time not see any error at all. The changer might not know the classes which are using his code. The other classes will neither get a compile time error or anything else, just some input values will no longer produce the correct output. (and this is a simple example, problems could be more hidden). Therefore I want to avoid var's at all cost. Is it possible? (I only find to turn of 'use var' in inspection severity)
The second question is: How to turn off that it wants to create Autoproperties instead of properties?
Is it possible to tell Resharper how brackets should be shown:
I want:
if()
{
multiline
}
if() { oneline;}
How could i tell it to resharper?
And how could i tell to it to use as many "this." as possible instead of warning about redunfdant this.?
Best regards
Please sign in to leave a comment.