ReSharper has features that look for inconsistencies in the use of keywords aliasing a type name. For example, it would see these two declarations and urge you to change one to be like the other (depending on which is set as your preference):
string myString1 = "String 1";
String myString2 = "String 2";
This is handy, because I always prefer using the keyword alias for the CLR types when declaring variables, and thus in the above example, I would want to correct the second line. However, this is also problematic because when using static members of the CLR types, I always prefer to use the type names and NOT the keywords. Consider the below example:
string myString1 = "String 1";
string myString2 = String.Format("{0} is String 1.", myString1);
If the option is set to prefer using the keyword, then ReSharper does not complain about the declarations, but it DOES complain about using the type name to access the static String.Format() method.
So, my question is... Is there any way to configure ReSharper such that it will prefer keywords for declarations but type names for static member access? In other words, can I configure it to not complain about any of the code in my second example above.
As of R# 2018.2, this is now possible:
Well, you can`t do that on ReSharper, it is already suggested, as in your post comments, in here. Anyways, the best thing you can do is ignoring it, i made a gif for it. (Please, ignore other codelines in the gif). I'm using ReSharper 9.1.3, FSF Licensed. I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With