我的代码包含许多用多行注释语法编写的文档注释,例如示例
/**
* This class is used as an example.
*
* To ask about multiline comments.
*/
class A {
}
/**
* Another example class with comment.
*/
class B {
}
Run Code Online (Sandbox Code Playgroud)
有时,在调试/重构或试验代码期间,我想注释掉部分代码。在此示例中,我想注释掉类A和B。有没有一种方法可以简单地做到这一点,而无需观察文档注释的开始和结束位置,也不需要使用一行注释语法分别注释每一行//?
Dart(与其他类似C的语法语言相反)本身支持嵌套的多行注释。
所以你可以写
/* Commented for debugging purposes!!! Do not forget to uncomment!!!
/**
* This class is used as an example.
*
* To ask about multiline comments.
*/
class A {
}
/**
* Another example class with comment.
*/
class B {
}
*/
Run Code Online (Sandbox Code Playgroud)
并且不要在乎注释块中的一些嵌套注释。
| 归档时间: |
|
| 查看次数: |
1254 次 |
| 最近记录: |