Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view the content of the <returns> tag?

In Microsoft Visual C# 2010 Express, whenever I create a function, and use the 3 slashes to create the help code, I get something like this:

/// <summary>
/// Function to sum 2 numbers.
/// </summary>
/// <param name="foo">First number.</param>
/// <param name="bar">Second number.</param>
/// <returns>The sum of the numbers.</returns>
public int foobar( int foo, int bar )
{
    return foo + bar;
}

I know that whenever I want to know what a function does, I can hover my mouse over it, and the tooltip shows the text written between the <summary> tags.

Also, whenever I open the parentheses to write the parameters of the function I'm calling, I see the tooltip below the cursor which displays the text written between the <param name="foo"> tags.

So, my question is: Can I view the text written between the <returns> tags without having to go to definition and view it in the code it's written in? And if so, how?

like image 224
user2323401 Avatar asked Jan 26 '14 13:01

user2323401


People also ask

What is XML comments C#?

C# documentation comments use XML elements to define the structure of the output documentation. One consequence of this feature is that you can add any valid XML in your documentation comments. The C# compiler copies these elements into the output XML file.

How do I view documents in Visual Studio?

The idea is that you get a summary in the intellisense tooltip, and can press F1 to show the full help, or F12 to jump to the declaration (which usually includes the documentation).

What is param tag in C#?

<param> Tag The <param> tag is used to describe parameters for a method or constructor. Let's say we have a method that adds two numbers together and returns the result as follows. 1 /// <param name="operand1">the left side operand.</

How do you write a summary comment in C#?

The first rule for commenting is it should have /// three slash for comments as C# supports C++ style commenting so commenting can be done by // -- two slashes -- but for Documentation /// is necessary. We will go through each one by one. You can add a paragraph to the description by using <para> tag.


1 Answers

You can view it in View >> Object Browser.

Apart from this you do not see it anywhere else. In case you would like to present the "return" information via a tooltip then it is better to put it inside the <summary> itself as a part of the description. There are some possibilities to make the <summary> more readeable when you want to put more text inside, e.g. by using <para>:

///<summary>
///<para>line1</para>
///<para>line2 (e.g. what a method returns)</para>
///</summary>
like image 138
Paweł Bejger Avatar answered Oct 20 '22 17:10

Paweł Bejger