Visual Studio: Equivalent of Eclipse's variable movement?
Developing Java with Eclipse, it's easy to move variables from one class to another, and have the references开发者_如何学C be updated. (So if you move size
from being a class variable to a class named Constants
, every reference to size
in the original class will be replaced by Constants.size
automatically.)
Is there a way to do this in C# XNA Visual Studio 2010?
The Devexpress RefactorPro! plugin has similar refactorings (though not I don't think that exact one). I think they're even all available in the free version. If you want a specific one that's not available though you can check the free DxCore plugins page or develop one yourself. It's not all that hard.
All the links are on the DxCore community plugins page.
Oh but, to answer your question very specifically no, I have never heard of that exact refactoring being available anywhere - it's not generally seen as CSharp-y.
Move variable is not one of the refactoring operations that is supported by C# out of the box in Visual Studio 2010 (or 2008 / 2005 for that matter). In order to get that kind of operation you will need to use a 3rd party plugin such as Resharper or DevExpress`s RefactorPro.
精彩评论