views:

232

answers:

2

Just a question of interest: Does anyone know why there's no block comment capability in VB .NET? (Unless there really is - but I've never yet come across it.)

+2  A: 

As can be read in “Comments in Code“ there isn't any other way:

If your comment requires more than one line, use the comment symbol on each line, as the following example illustrates.

' This comment is too long to fit on a single line, so we break 
' it into two lines. Some comments might need three or more lines.

Similarly, the help on the REM statement states:

Note:
You cannot continue a REM statement by using a line-continuation sequence (_). Once a comment begins, the compiler does not examine the characters for special meaning. For a multiple-line comment, use another REM statement or a comment symbol (') on each line.

Joey
+5  A: 

It is a side-effect of the Visual Basic syntax, a new-line terminates a statement. That makes a multi-line comment pretty incompatible with the basic way the compiler parses the language. Not an issue in the curly brace languages, new-lines are just white space.

It has never been a real problem, Visual Basic has had strong IDE support for a very long time. Commenting out multiple lines is an IDE feature, Edit + Advanced + Comment Selection.

Hans Passant
+1 The IDE handles all of this stuff for me, allowing me to focus on writing good code that should never need to be commented out
Josh Stodola
With CTRL+K+C and CTRL+K+U you don't need block comments :)
_simon_
Also - in C#, when you write /*, the editor automaticaly converts all code, that follows, to comment, so you loose outlining. That's why I don't use block comments in C# also.
_simon_