Kirito
Kirito

Reputation: 175

How I can do a reference code in my C# documentation?

I am doing the HTML format documentation for my C# code and I'd like to know if it's possible to do a reference inside my own code.

For example:

public class Test{
public bool Calculate(int x){ //code }
}

public class Check{
void Checking(int y, int x, int z){
//code
bool aux = Test.Calcultate(x);
//code
}

When I'm doing the documentation like this:

 /// <summary>
 /// 
 /// </summary>
 /// <param name=""></param>
 /// <returns></returns>

How I can do a reference into documentation from the method Checking to the method Calculate? I mean, if I'm watching the documentation of the method Checking, there must be a link to Calculate

Upvotes: 2

Views: 84

Answers (2)

RobertBaron
RobertBaron

Reputation: 2854

You can use the <see> tag. See its documentation. For example, put in the <remarks> section of the Checking function:

<see cref="Calculate"/>

and you will get a link to the documentation page of the Calculate function. Note that documentation tags work only in xml documentation comments. You can put them in comments in your code, but you will not get a link.

Upvotes: 0

DavidG
DavidG

Reputation: 118937

You should use the <see> element, for example:

/// <summary>
/// This uses the <see cref="Test.Calculate"/> method
/// </summary>
/// <param name=""></param>
/// <returns></returns>
void Checking(int y, int x, int z)
{
    //code
    bool aux = Test.Calcultate(x);
    //code
}

This will show up in IntelliSense like this:

enter image description here

Upvotes: 1

Related Questions