C#中的XML多行注释 - 我做错了什么?

Dav*_*ave 26 c# comments multiline xml-comments visual-studio-2008

根据这篇文章,可以获得多行XML注释 - 而不是使用///,使用/** */.这是我对多行注释的解释,以及我想要发生的事情:

/**
 * <summary>
 * this comment is on line 1 in the tooltip
 * this comment is on line 2 in the tooltip
 * </summary>
 */
Run Code Online (Sandbox Code Playgroud)

但是,当我使用这个表单时,当我将鼠标悬停在我的代码中时弹出的工具提示是单行的,即它看起来就像我写了这样的评论:

/// <summary>
/// this comment is on line 1 in the tooltip
/// this comment is on line 2 in the tooltip
/// </summary>
Run Code Online (Sandbox Code Playgroud)

这种行为实际上是否仍然可以在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>
Run Code Online (Sandbox Code Playgroud)

当我在我的代码中查看此类的工具提示时,所有内容仍然会在一行中结束... 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>
Run Code Online (Sandbox Code Playgroud)

Gab*_*abe 16

听起来你对"多线"意味着什么感到困惑.单行注释在源代码行的末尾结束,如果要继续该注释,则必须///在下一行添加" ".多行注释以" /*" 开头,以" "结尾,*/因此它可以在同一行或多行中结束.

作为"多行",没有说明评论中的文本是如何显示的.要在XML注释中添加换行符,必须插入<br/>("break")或将行包装在<para>("paragraph")标记中.

  • 实际上,我确实需要使用<br/>因为我想控制换行符.我继续在我的评论中添加了到每一行的末尾,它仍然将工具提示中的所有内容放在一行中. (4认同)
  • 好吧,每行上的<para>都有效...谢谢! (2认同)

bic*_*bic 14

试试这个

/// <summary>
/// this comment is on line 1 in the tooltip
/// <para>this comment is on line 2 in the tooltip</para>
/// </summary>
Run Code Online (Sandbox Code Playgroud)