Question

I am currently a programming student, and obviously my question is simple, but I haven't been able to find the answer to it online. So here it is:

In XML /// comments in C#, where does the <returns> tag show up, I know that everything contained in the <summary> tag shows up in intellisense when you hover your mouse over your method call, but not the returns tag.

So where does the <returns> tag come in?

Thanks.

Was it helpful?

Solution

When you see the method in View >> Object Browser

For e.g. you will see something like this:

private int GetColumnIndex(Microsoft.Office.Interop.Excel.Worksheet worksheet, string columnName, int rowIndex, int startColumnIndex)
    Member of MyAddIn.CommandHandlers.CommandHandler

Summary:
Returns the column index with specified name and in specified row

Parameters:
worksheet: Target worksheet
columnName: Column name to find
rowIndex: Row index in which to search the column
startColumnIndex: Start index of the column

Returns:
The index of column if found, else returns 0

OTHER TIPS

If you generate API documentation from the comments, it will show up in the Return value section, as seen here, right before the Remarks section.

When you choose to build an XML documentation file on compilation, then everything that is contained in the XML documentation comments gets copied over into that file. Programs like Sandcastle then can build HTML documentation akin to the MSDN from that.

It doesn't show in Visual Studio's own IntelliSense, as far as I know. But that's no excuse not to write something there :-). ReSharper's Ctrl+Q for example does show it.

The other sections (basically anything exception summary) won't appear in intellisense. They are only intended to appear in documentation generated from the XML, using a tool like Sandcastle.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top