加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

XML多行注释在C# – 我做错了什么?

发布时间:2020-12-16 08:06:02 所属栏目:百科 来源:网络整理
导读:根据 this article,可以获得多行XML注释 – 而不是使用///,使用/ ** * /。这是我对多行评论的解释,以及我想要发生的事情: /** * summary * this comment is on line 1 in the tooltip * this comment is on line 2 in the tooltip * /summary */ 但是,
根据 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>
听起来你对“多行”的含义感到困惑。单行注释在源代码行的结尾处结束,如果要继续该注释,则必须在下一行放置一个“///”。多行注释以“/ *”开头,以“* /”结尾,因此它可以在同一行或多行下结束。

“多行”不会说明评论中的文本是如何显示的。要在XML注释中插入换行符,您必须插入< br /> (“break”)或将行包含在< para> (“段落”)标记。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读