简体   繁体   English

vb.net 中的多行注释

[英]multiline comment in vb.net

Do we have a multi line comment in VB.net.我们在 VB.net 中有多行注释吗?
I know in Java we have /* */ but that doesn't seem to work here.我知道在 Java 中我们有 /* */ 但这似乎在这里不起作用。

No we dont unfortunately..........不,我们不不幸......

You can do: Ctrl + K, Crtl + C你可以这样做:Ctrl + K,Crtl + C

To uncomment ctrl+k ctrl+u取消注释 ctrl+k ctrl+u

In Visual Basic .Net 2008 and 2010, I use the following C++ Workaround.在 Visual Basic .Net 2008 和 2010 中,我使用以下 C++ 解决方法。

#If AFAC Then

#End if

For english speaking AFAC = "à effacer" = "to delete"对于英语 AFAC = "à effacer" = "to delete"

I alreay use #If COMMENT or #If TODO我已经使用#If COMMENT#If TODO

The #if COMMENT then solution is more power than the C++/Java/C# /* text */ solution because it is possible to imbricate (embed) #if but not /* !!! #if COMMENT then解决方案比 C++/Java/C# /* text */解决方案更强大,因为它可以叠加(嵌入) #if但不能/* !!!

For more information see the following link有关更多信息,请参阅以下链接

只需按住“alt”+“shift”并向上或向下移动光标以选择行,然后按“'”

Not possible.不可能。 Write your chunk, select it and press Ctrl+K, Ctrl+C to comment it.编写块,选择它并按 Ctrl+K、Ctrl+C 对其进行评论。

But it doesn't always matter as often you use ''' in front of a method or property to describe it.但是并不总是像在方法或属性前使用 ''' 来描述它那样重要。 Then it will automatically create the comments for you.然后它会自动为您创建评论。

Only single-line comments are possible in VB, unlike C/C++ and it's derivatives (Java, JavaScript, C#, etc.).与 C/C++ 及其衍生物(Java、JavaScript、C# 等)不同,VB 中只能使用单行注释。 You can use the apostrophe " ' " or REM (remark) for comments like this:您可以使用撇号“'”或 REM(备注)来表示这样的注释:

Sub Main()  
    ' This is a comment  
    REM This is also a comment  
End Sub  

But there is no multi-line comment operator in VB, unless you count using the keyboard shortcuts like @JonH and @Tedd Hansen said.但是在 VB 中没有多行注释运算符,除非您使用 @JonH 和 @Tedd Hansen 所说的键盘快捷键进行计数。

you can do on all visual studio version ..你可以在所有 Visual Studio 版本上做..

#Region "mycomment"
 'comment line1
 'comment line2
#End Region

you will be able to hide and show the entire block您将能够隐藏和显示整个块

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM