首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在C# .NET文档中添加换行符

如何在C# .NET文档中添加换行符
EN

Stack Overflow用户
提问于 2011-09-02 12:02:26
回答 5查看 82.3K关注 0票数 230

这应该会容易得多。

我想在我的代码中为XML文档添加一个“编码”的换行符

代码语言:javascript
复制
/// <summary>
/// Get a human-readable variant of the SQL WHERE statement of the search element. &lt;br/&gt;
/// Rather than return SQL, this method returns a string with icon-tokens, which 
/// could be used to represent the search in a condensed pictogram format.
/// </summary>

正如您所看到的,我找到了一些演示添加<和>括号的答案。有趣的是,良好的< br/ >换行符不会在Intellisense弹出窗口中创建换行符。

我觉得这很烦人。

有什么建议吗?

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2011-09-02 12:04:49

您可以使用<para />标签来生成分段符,也可以将<para></para>标签中的文本换行,以此作为对文本进行分组并在其后面添加空行的一种方式,但是<br />或类似的东西是没有等价物的。(根据this以前的MS论坛帖子,这是设计出来的。)您可以从Documenting your code女士的文档文章中获得可用标记的列表

示例(基于原始OP示例):

代码语言:javascript
复制
/// <summary>
/// <para>Get a human-readable variant of the SQL WHERE statement of the search element.</para>
/// Rather than return SQL, this method returns a string with icon-tokens, which 
/// could be used to represent the search in a condensed pictogram format.
/// </summary>
票数 369
EN

Stack Overflow用户

发布于 2019-08-31 09:17:47

从Visual Studio2019开始,注释中的换行符使用<br/>

示例:

代码语言:javascript
复制
/// <summary>
/// This is a comment.<br/>
/// This is another comment <br/>
/// This is a long comment so i want it to continue <br/> on another line.
/// </summary>

请注意,当我们使用<br/>而不是<para>时,没有添加额外的行。

票数 128
EN

Stack Overflow用户

发布于 2014-09-02 10:56:43

这是我的用法,就像<br/>一样,它是有效的:)

代码语言:javascript
复制
/// <summary>
/// Value: 0/1/2
/// <para/>0 foo,
/// <para/>1 bar,
/// <para/>2 other
/// </summary>
票数 85
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7279108

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档