C#中的XML多行注释 – 我做错了什么?
根据这篇文章 ,可以获得多行XML注释 – 而不是使用///
,使用/** */
。 这是我对多行注释的解释,以及我想要发生的事情:
/** * * this comment is on line 1 in the tooltip * this comment is on line 2 in the tooltip * */
但是,当我使用这个表单时,当我将鼠标hover在我的代码中时弹出的工具提示是单行的,即它看起来就像我写了这样的评论:
/// /// this comment is on line 1 in the tooltip /// this comment is on line 2 in the tooltip ///
这种行为实际上是否仍然可以在VS2008中使用?
编辑
gabe指出我误解了“多线”意味着什么,我实际上需要使用或
来达到预期的效果。 我继续使用
因为我想控制换行的位置,即
/// /// this comment is on line 1 in the tooltip
/// this comment is on line 2 in the tooltip
///
当我在代码中查看此类的工具提示时,所有内容仍然会在一行中结束… WTH? 我在这里做错了吗?
UPDATE
好的,我继续在每一行上尝试标签,这是有效的。 不知道为什么不这样做。
/// /// this comment is on line 1 in the tooltip /// this comment is on line 2 in the tooltip ///
听起来你对“多线”意味着什么感到困惑。 单行注释在源代码行的末尾结束,如果要继续该注释,则必须在下一行添加“ ///
”。 多行注释以“ /*
”开头,以“ */
”结尾,因此它可以在同一行或多行中结束。
作为“多行”,没有说明评论中的文本是如何显示的。 要在XML注释中添加换行符,必须插入一个
(“break”)或将该行包装在
(“paragraph”)标记中。
试试这个
/// /// this comment is on line 1 in the tooltip /// this comment is on line 2 in the tooltip ///
添加
用于换行符或将段落括在
。 就像XML和HTML一样,换行符只不过是空格。