XML多行注释在C# - 我做错了什么? [英] XML multiline comments in C# - what am I doing wrong?
问题描述
根据这篇文章,这是可能的以获取多行XML注释 - 而不是使用 ///
,请使用 / ** * /
。这是我对多行评论是什么,以及我想要发生的解释:
According to this article, it's possible to get multiline XML comments -- instead of using ///
, use /** */
. This is my interpretation of what multiline comments are, and what I want to have happen:
/**
* <summary>
* this comment is on line 1 in the tooltip
* this comment is on line 2 in the tooltip
* </summary>
*/
但是,当我使用这个表单时,弹出的工具提示在我的代码中悬停在我的类名称是单行的,即它看起来完全像我写了我的评论像这样:
However, when I use this form, the tooltip that pops up when I hover over my class name in my code is single-line, i.e. it looks exactly as if I had written my comment like this:
/// <summary>
/// this comment is on line 1 in the tooltip
/// this comment is on line 2 in the tooltip
/// </summary>
这种行为在VS2008中真的可能吗?
Is this behavior actually possible still in VS2008?
EDIT
gabe指出,我误解了multiline的意思,我实际上需要使用< para>
或< br>
我继续使用< br>
,因为我想控制换行的位置,即
gabe pointed out that I have misunderstood what "multiline" means, and I actually need to use <para>
or <br>
to get my intended effect. I went ahead and used <br>
because I want to control where the line breaks occur, i.e.
/// <summary>
/// this comment is on line 1 in the tooltip<br/>
/// this comment is on line 2 in the tooltip<br/>
/// </summary>
当我在我的代码中看到这个类的工具提示时,一切仍然结束在一行。 .. WTH?我在这里做错了吗?
When I look at the tooltip for this class in my code, everything still ends up on one line... WTH? Did I do something wrong here?
UPDATE
并尝试每行上的< para>
标签,并且工作。不确定为什么< br />
不。
Ok, I went ahead and tried the <para>
tag on each line, and that works. Not sure why <br/>
doesn't.
/// <summary>
/// <para>this comment is on line 1 in the tooltip</para>
/// <para>this comment is on line 2 in the tooltip</para>
/// </summary>
推荐答案
线。单行注释在源代码行的结尾处结束,如果要继续该注释,则必须在下一行中输入 ///
。多行注释以 / *
开头,并以 * /
结尾,
It sounds like you are confused about what "multi-line" means. A single-line comment ends at the end of the line of source code, and if you want to continue that comment you must put a "///
" on the next line. A multi-line comment starts with a "/*
" and ends with a "*/
" so it can end either on the same line or multiple lines down.
多行不会说明评论中的文本是如何显示的。要在XML注释中插入换行符,必须插入< br />
(break)或将行包含在 ; para>
(paragraph)标记。
Being "multi-line" says nothing about any how the text within the comment is displayed. To put a line break in an XML comment you must insert a <br/>
("break") or wrap the line in a <para>
("paragraph") tag.
这篇关于XML多行注释在C# - 我做错了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!