Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I reference method parameters in a method summary when writing XML documentation?

Suppose I have a method as follows:

    /// <summary>
    /// Here I want to reference the parameter <see cref="personId"/>.
    /// </summary>
    /// <param name="personId">
    /// The person id.
    /// </param>
    /// <returns>
    /// The <see cref="Person"/>.
    /// </returns>
    public Person GetPerson(int personId)
    {
        
    }

When I publish my XML documentation using Sandcastle, the cref:

<see cref="personId"/>

gets converted to [!:personId].

The warning in Sandcastle is:

Unknown reference link target

Any advice?

like image 320
user2078938 Avatar asked May 15 '15 08:05

user2078938


People also ask

Which is the proper commenting method for XML?

To insert XML comments for a code element Type /// in C#, or ''' in Visual Basic.

What is XML summary?

Extensible Markup Language (XML) is a markup language used to describe the content and structure of data in a document. It is a simplified version of Standard Generalized Markup Language (SGML). XML is an industry standard for delivering content on the Internet.

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.

What is the comment syntax for C #s XML based documentation?

XML documentation comments - document APIs using /// comments | Microsoft Docs.


1 Answers

Use <paramref>

<paramref name="personId"/>
like image 145
dcastro Avatar answered Sep 29 '22 15:09

dcastro