Visual Studio 编辑器:删除结构化 IF/End If
有没有简单的方法来删除 IF/End If 结构化配对。 如果能够通过一次按键完成此操作,那就太好了(我也使用 Refactor! Pro),
现在这就是我所做的:
- 删除 IF 行,
- 观看 Visual Studio 重新格式化代码以正确排列,同时考虑到缺少 IF 的帐户。
- 导航到 End If
- 删除 End If 行
,即在下面的示例中,我想将代码从
IF Value = True Then
DoSomething()
DoSomething2()
End IF
To更改为
DoSomething()
DoSomething2()
Is there and easy way to remove the IF/End If structured pairing.
Being able to do this in one keystroke would be nice (I also use Refactor! Pro)
Right now this is what I do:
- Delete the IF line
- Watch Visual Studio reformat the code to line up correctly taking into account that the IF is Missing.
- Navigate to the End If
- Delete the End If line
i.e. In the following example I want to change the code from
IF Value = True Then
DoSomething()
DoSomething2()
End IF
To
DoSomething()
DoSomething2()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然这不是 Martin Fowler 的书 重构 所指定意义上的字面重构,但这就是我使用 resharper 来实现此目标:
完成。 不太简单,但击键很短,也不太复杂,而且我不必花费/浪费时间使用愚蠢的箭头键或鼠标来完成此类代码更改。
我相信,Resharper 从 4.0 开始支持 VB.net 代码。
While this is not a literal refactoring in the sense specified by Martin Fowler's book Refactoring, This is how I use resharper to achieve this goal:
Done. Not quite simple, but the keystrokes are short, and not too complicated, and I don't have to spend/waste time with dumb arrow keys or the mouse to accomplish this type of code change.
Resharper supports VB.net code as of 4.0, I believe.