问题
Resharper does suggest me the usage of the var-keyword. Unfortunately, my new employer does not use var-keyword at all. Thats why I am having some trouble, because I am used to use the var-keyword.
Is it possible to let resharper do the opposite thing? So, it warns me everytime I use the var keyword and suggests me to declare the variable explicitly?
Thanks in advance!
Edit:\
I dont want to turn off the warning or something like that, I want to turn that Setting around, so I will get a warning whenever I'm using var.
回答1:
From the toolbar at the top click Resharper - Options - Code Editing - C# - Code Style you will find 'var usage declarations' you then need to set the preference to 'Use explicit type' for 'Built in types', 'Simple Types' & 'Elsewhere'.
回答2:
Go to Resharper Options, then to Code Editing->C#->Code Style.
There you can set everything like you want it.
Select your needed Preference or the notification level.
回答3:
You can set the inspection severity in Resharper-Options-Code Inspection-Inspection Severity-C#
and search for var
And you can set if var is prefered or not as well:
来源:https://stackoverflow.com/questions/32630460/resharper-suggests-the-usage-of-var-can-it-do-the-opposite-thing-aswell