Search code examples
c#documentation

How do I document mathematical computations inside my code


I am documenting a large application that does a lot of mathematical computations. The computation itself is very simple but it is a lot. My question: Is there a way to document these calculations efficiently? Here is an example (Note: there are hundreds of lines of operations like this):

double printJobTime = (zHeight / (surfaceDensity / 1000)) * buildTime;

Solution

  • I suggest use XML comment as follow:

    /// <summary>
    /// [Explaine the method function...]
    /// </summary>
    /// <param name="..."></param>
    /// <param name="..."></param>
    /// <returns>[Explaine the result...]</returns>
    public ... [YourMethod]()
    {
        ...
    }
    

    Take a look at the following link:

    How to: Insert XML comments for documentation generation

    By enabling the XML Documentation file: (in the project properties)

    enter image description here

    The XML Documentation file will generate automatically when build the project.