阻止评论被字符串

时间:2015-08-03 13:47:34

标签: c# visual-studio comments block-comments

这是一个生活质量问题,可能非常简单,但是,我似乎找不到答案。

如果您开始阻止评论......

/*
my code here
string url = "lorumipsum....*/...lorumipsum"; <---this "*/" is closing the comment early
more code
*/

它被字符串中的任何“* /”关闭。有办法逃避这个吗?或者我只是手动“//”该行并阻止评论其余部分?

2 个答案:

答案 0 :(得分:4)

您可以从工具栏中选择所有文本和注释(快捷方式: Ctrl + K + U )。它会在所有选定的行前面添加//

///*
//my code here
//string url = "lorumipsum....*/...lorumipsum"; <---this "*/" is closing the         comment early
//more code
//*/

无需手动执行此操作。

工具栏图片
enter image description here

答案 1 :(得分:3)

或者,你可以按住 Alt -key,点击并绘制你要注释掉的所有行,然后只需在它们前面输入//多-编辑模式。