Visual Studio 2010 中的多行注释 vb.net

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5254106/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 15:20:29  来源:igfitidea点击:

multi line comment vb.net in Visual studio 2010

vb.netvisual-studio-2010comments

提问by sarsnake

Possible Duplicate:
commenting VB code
Lack of block comments in VB .NET?

可能的重复:
注释 VB 代码
VB .NET 中缺少块注释?

How to?

如何?

Is there a way to comment out more than one line of code in vb.net using VS 2010?

有没有办法使用 VS 2010 注释掉 vb.net 中的多行代码?

回答by nickmoriarty

The only way is to highlight the lines to comment and press

唯一的方法是突出显示要评论的行并按

ctrl + k, ctrl + c

or after highlighted press the toolbar option to comment out the selected lines.

或在突出显示后按工具栏选项注释掉选定的行。

The icons look like this enter image description here

图标看起来像这样 在此处输入图片说明

回答by user1985128

I just learned this trick from a friend. Put your code inside these 2 statements and it will be commented out.

我刚刚从朋友那里学到了这个技巧。将您的代码放在这两个语句中,它将被注释掉。

#if false

#endif

回答by Chris Jacob

Highlight block of text, then:

突出显示文本块,然后:

Comment Block:Ctrl+ K+ C

注释块:Ctrl+ K+C

Uncomment Block:Ctrl+ K+ U

取消注释块:Ctrl+ K+U

Tested in Visual Studio 2012

在 Visual Studio 2012 中测试

回答by Crimsonland

multi comment in vb.net

vb.net 中的多条评论

VB.NET doesn't support for multi line comment.

VB.NET 不支持多行注释。

The only way to do multi-line comments in VB.NET is to do a lot of single line comments(').

在 VB.NET 中做多行注释的唯一方法是做很多单行注释( ')。

Or just highlight the whole code and just use (Ctrl+E,C), (Ctrl+E,U)to comment or uncomment.

或者只是突出显示整个代码,然后使用(Ctrl+E,C),(Ctrl+E,U)进行注释或取消注释。

Only in c# /* */

仅在 C# 中 /* */

Or in ASP.NET html source using <!-- -->.

或者在 ASP.NET html 源中使用<!-- -->.

回答by A_Sea

Create a new toolbar and add the commands

创建一个新工具栏并添加命令

  • Edit.SelectionComment
  • Edit.SelectionUncomment
  • Edit.SelectionComment
  • Edit.Selection取消注释

Select your custom tookbar to show it.

选择您的自定义 Takebar 以显示它。

You will then see the icons as mention by moriartyn

然后,您将看到moriartyn 提到的图标

回答by Hiawatha Tiller

The only way I could do it in VS 2010 IDE was to highlight the block of code and hit ctrl-E and then C

我在 VS 2010 IDE 中可以做到的唯一方法是突出显示代码块并按 ctrl-E 然后按 C