Поделиться через


How to: Create JScript XML Code Comments

XML code comments are JScript (JavaScript) comments that you add to script functions to provide a summary and information about the function's parameters and return value. In Visual Studio, these text descriptions are displayed with IntelliSense when you reference the script function.

Note

XML code comments are available only from referenced files, assemblies, and services.

To create XML code comments for a JScript function

  • Inside include summary, param, and returns elements, and precede each element with three slashes (///).

    Note

    The elements must be on a single line.

    The following example shows a JScript function that includes each of the three elements that is supported in XML code comments.

    <script type="text/javascript">
      function areaFunction(radiusParam)
      {
          /// <summary>Determines the area of a circle based on a radius parameter.</summary>
          /// <param name="radius" type="Number">The radius of the circle.</param>
          /// <returns type="Number">The area.</returns>
          var areaVal;
          areaVal = Math.PI * radiusParam * radiusParam;
          return areaVal;
      }
    </script>
    

To view XML code comments using IntelliSense

  • Type the name and the opening parenthesis of a function that is marked with XML code comments, as in the following example:

    var areaVal = areaFunction(
    

    When you type the opening parenthesis of the function that contains the XML code comments, the editor uses IntelliSense to display the information that is defined in XML code comments.

See Also

Tasks

Walkthrough: JScript IntelliSense

Concepts

JScript IntelliSense Overview