[英]XML multiline comments in C# - what am I doing wrong?
根据这篇文章 ,可以获得多行XML注释 - 而不是使用///
,使用/** */
。 这是我对多行注释的解释,以及我想要发生的事情:
/**
* <summary>
* this comment is on line 1 in the tooltip
* this comment is on line 2 in the tooltip
* </summary>
*/
但是,当我使用这个表单时,当我将鼠标悬停在我的代码中时弹出的工具提示是单行的,即它看起来就像我写了这样的评论:
/// <summary>
/// this comment is on line 1 in the tooltip
/// this comment is on line 2 in the tooltip
/// </summary>
这种行为实际上是否仍然可以在VS2008中使用?
编辑
gabe指出我误解了“多线”的含义,我实际上需要使用<para>
或<br>
来达到预期的效果。 我继续使用<br>
因为我想控制换行的位置,即
/// <summary>
/// this comment is on line 1 in the tooltip<br/>
/// this comment is on line 2 in the tooltip<br/>
/// </summary>
当我在我的代码中查看此类的工具提示时,所有内容仍然会在一行中结束... WTH? 我在这里做错了吗?
UPDATE
好的,我继续在每一行上尝试<para>
标签,这是有效的。 不知道为什么<br/>
没有。
/// <summary>
/// <para>this comment is on line 1 in the tooltip</para>
/// <para>this comment is on line 2 in the tooltip</para>
/// </summary>
听起来你对“多线”意味着什么感到困惑。 单行注释在源代码行的末尾结束,如果要继续该注释,则必须在下一行添加“ ///
”。 多行注释以“ /*
”开头,以“ */
”结尾,因此它可以在同一行或多行中结束。
作为“多行”,没有说明评论中的文本是如何显示的。 要在XML注释中添加换行符,必须插入一个<br/>
(“break”)或将该行包装在<para>
(“paragraph”)标记中。
尝试这个
/// <summary>
/// this comment is on line 1 in the tooltip
/// <para>this comment is on line 2 in the tooltip</para>
/// </summary>
添加<br/>
用于换行符或将段落括在<para>...</para>
。 就像XML和HTML一样,换行符只不过是空格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.