Convert "var" to explicit type in Visual Studio?

carlbenson picture carlbenson · Feb 1, 2012 · Viewed 7k times · Source

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.

Answer

Devin Burke picture Devin Burke · Feb 1, 2012

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.