Visual Studio - 整理变量声明

发布于 2024-12-25 13:39:47 字数 452 浏览 2 评论 0原文

Visual Studio 中是否有任何捷径来整理变量声明。

例如,我正在通过编写一个方法来工作,并且因为我更关注该方法的逻辑而不是整洁性,所以我可能会在顶部声明我认为需要的变量,然后在需要时再声明一些变量,例如我继续。

string myString, mySecondString;

myString = "Foo";
mySecondString = "Barr";

string forgotINeededThisOne = String.Format("{0} - {1}", myString, mySecondString);

有什么方法可以快速执行此操作:

string myString, mySecondString, forgotINeededThisOne;

或者我需要手动执行此操作吗?

谢谢

Is there any short cut in Visual Studio to tidy up Variable Declaration.

For example, I am working my way through writing a method, and because I am focusing more on the logic of the method than on tidiness I maybe declare the variables I think I need at the top, then a few more as I need them as I go on.

string myString, mySecondString;

myString = "Foo";
mySecondString = "Barr";

string forgotINeededThisOne = String.Format("{0} - {1}", myString, mySecondString);

Is there any way I can quickly do this:

string myString, mySecondString, forgotINeededThisOne;

Or do I need to do this manually?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文