Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link / group overloads in C# XML comments?

In XML documentaiton comments for C#, is there a way to mark two or more functions to be overloads of each other, so that they reference each other automatically? Ideally, they'd also be grouped in the sandcastle-generated documentation somehow.

Purpose: Often, I want to link to this group of functions, e.g. in a list of utility functions, just mention one of the overloads, and make the others easily discoverable from there.

Currently I am adding links, but that's tedious.

like image 302
peterchen Avatar asked Dec 26 '08 11:12

peterchen


2 Answers

The relationship between multiple overloads are already identified and grouped by XMl documentation and Sandcastle.

Creating links to other members using the see or seealso tags.

Eg.

///See <see cref="M:AnotherMethod(System.String)">

I've found though that Sandcastle member resolution can be a bit flaky so I tend to use fully qualified names.

///See <see cref="M:MyCompany.Myapp.MyClass.AnotherMethod(System.String)">

Note the M: indicates a member is being referenced, you also use E: to point to an Event. T: is used for type but that is assumed if not present.

like image 170
AnthonyWJones Avatar answered Sep 20 '22 17:09

AnthonyWJones


Grouping is done automatically by Sandcastle, right, but if you want to give overload group a common description, use <overloads> tag for this (in the same way as <summary>). It is not a standard XML documentation tag but AFAIR it is supported by Sandcastle Help File Builder.

like image 38
vlad2135 Avatar answered Sep 20 '22 17:09

vlad2135