Search code examples
c#xml-documentation

How to refer to class properties in XML docs C#?


Suppose I have a method in a class

public class MyClass{
   public int MyInt;

   /// <summary>
   /// Prints out the value of <paramref name="MyInt">
   /// </summary>
   public void PrintValueOfMyInt()
   {
     ...
   }
}

Is this the correct way to refer to the MyInt member in the XML doc above PrintValueOfMyInt? If not, how to do it?


Solution

  • A solution is to use <see cref="MyInt"/>, so in total we get:

    /// <summary>
    /// Prints out the value of <see cref="MyInt"/>
    /// </summary>
    public void PrintValueOfMyInt()
    {
      ...
    }