根据 this article , 可以获得多行 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?我在这里做错了什么吗?
更新
好的,我继续尝试 <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>
最佳答案
试试这个
/// <summary>
/// this comment is on line 1 in the tooltip
/// <para>this comment is on line 2 in the tooltip</para>
/// </summary>
关于c# - C# 中的 XML 多行注释 - 我做错了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2547327/