Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert "var" to explicit type in Visual Studio? [duplicate]

Possible Duplicate:
Tool to refactor C# var to explicit type

Does Visual Studio have any type of shortcut (shortcut meaning short of writing out the actual type name) that allows you to write "var" and have it converted to the actual type name?

ex:

var x = new Dictionary<string, string>(); 

::Do magic thing::

Dictionary<string, string> x = new Dictionary<string, string>(); 

EDIT -- To all the question haters: I asked because I was in a situation where I wanted to find all references to a particular type in my solution. Vars don't show up in that search.

like image 974
carlbenson Avatar asked Feb 01 '12 19:02

carlbenson


1 Answers

Third party tools such as Resharper can convert implicitly typed variables to explicitly typed, and vice versa. Resharper lets you massively convert all of them or pick and choose which instances to convert.

But let me direct you to Will using 'var' affect performance?, where the arguments for and against implicitly typing are made.

like image 196
Devin Burke Avatar answered Oct 14 '22 13:10

Devin Burke