Visual Studio 2010 'Assign to local variable' function?

冷暖自知 提交于 2019-12-01 14:39:48

问题


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?


回答1:


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.




回答2:


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.




回答3:


If you are using Resharper Shortcut is Ctrl+R,V



来源:https://stackoverflow.com/questions/2793581/visual-studio-2010-assign-to-local-variable-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!