Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 'Assign to local variable' function?

I'm in love with the function in Eclipse "assign to field". Basically, when I have

getString();

and I type Ctrl + 2, Eclipse converts this into

String getString = getString();

Is this possible in VS 2010?

like image 657
Frank Meulenaar Avatar asked May 08 '10 09:05

Frank Meulenaar


2 Answers

I believe the thing you're looking for is a refactoring typically called "introduce variable". As far as I know, Visual Studio doesn't support this. However ReSharper and other tools like it do.

like image 84
Rytmis Avatar answered Oct 21 '22 04:10

Rytmis


I have not worked in eclipse for years so I am not familiar with the example, but have you tried code snippets in VS?

There is a tool for customizing them that you can get from here.

like image 33
Mark Pearl Avatar answered Oct 21 '22 05:10

Mark Pearl