.net 为 Intellisense 的注释添加换行符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/467202/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 11:03:21  来源:igfitidea点击:

Adding line breaks to comments for Intellisense

.netintellisenseintellisense-documentati

提问by flesh

Does anyone know how to insert a line break into a summary comment in order for the line break to be reflected in Intellisense documentation?

有谁知道如何在摘要注释中插入换行符,以便在 Intellisense 文档中反映换行符?

To clarify, assume code documentation..

为了澄清,假设代码文档..

/// <summary>
/// Some text documentation
///  - a line break - 
/// Some more documentation
/// </summary>
public void SomeMethod() { }

So when using this method Intellisense offers a summary for the method formatted like this:

因此,当使用此方法时,Intellisense 提供了格式如下的方法摘要:

Some text documentation

Some more documentation

一些文本文档

更多文档

(Note - the 'para' tag doesn't create empty line breaks - I've tried it!)

(注意 - 'para' 标签不会创建空换行符 - 我已经试过了!)

回答by Brian Kim

Try using this.

尝试使用这个。

/// <summary>
/// <para>Paragraph 1.</para>
/// <para>Paragraph 2.</para>
/// </summary>

But I don't think you can have an actual empty line. Empty para tag gets ignored.

但我不认为你可以有一个实际的空行。空的 para 标签被忽略。

回答by theKRAY

Try this:

尝试这个:

/// <summary>
/// <para>?[Non-Breaking Space]?</para>
/// </summary>

[Non-Breaking Space]is obtained using Alt+255(using the Numpad).

[Non-Breaking Space]使用Alt+ 255(使用数字键盘)获得。

It will show up as an empty new line. I know this is old, but it worked for me today.

它将显示为一个空的新行。我知道这很旧,但它今天对我有用。

回答by theKRAY

/// <summary><br />
/// <para>To treat comment line like a DIV tag, surround them with PARA tags.</para><br />
/// <para>To add a break with whitespace, add the following line:</para><br />
/// <para>&#160;</para><br />
/// </summary>

回答by Andrew Hare

Your only hope is probably something cludgy like this:

你唯一的希望可能是这样的笨拙:

/// <summary>
/// <para>line one</para>
/// <para>_</para>
/// <para>line two</para>
/// </summary>

回答by Joel Coehoorn

Well, it is Xml. Maybe &#10;&#13;

嗯,它是Xml。也许&#10;&#13;