Share via


Supplying XML Code Comments

Code comments refer to comments placed in source code files that are available to users of the integrated development environment (IDE) via the IntelliSense feature.

[Visual Basic]

XML code comments are available in Visual Basic through the ''' (three single quotation marks) delimiter. For more information, see How to: Create XML Documentation in Visual Basic.

[C#]

You can use the XML Documentation feature to comment code. When you annotate types and members that are defined in the source files of your solutions with XML Documentation comments, those comments will be displayed through IntelliSense features, such as:

Note

When commenting partial methods, only comments placed in the implementation, not definition, appear in IntelliSense features.

For more information, see XML Documentation Comments (C# Programming Guide).

[C++]

By default, any comments in the source code that use the // or /* delimiters are displayed next to their associated member in the Members list. For more information, see C++ Comments and XML Documentation (Visual C++).

As you scroll through the list, IntelliSense displays up to 12 lines of the comment in a pop-up window next to the highlighted member. When more than one comment exists for a function, IntelliSense determines which comment to display in the Members list by where it appears in the code:

  1. IntelliSense first displays end-of-line comments in the declaration. For example:

    void MyFunction();   //EOL declaration comments
    
  2. If IntelliSense does not find the previous type of comment, it displays comments that appear directly above the declaration with no blank lines in between. For example:

    //Before declaration comments
       void MyFunction();
    
  3. If the previous two types of comments are not found in the code, IntelliSense displays end-of-line comments in the definition. For example:

    int CMyAppDoc::MyVariable=2; // EOL definition comments
    
  4. Finally, if none of the previous types of comments appear in the code, IntelliSense displays comments that appear directly above the definition with no blank lines in between. For example:

    //Before definition comments
    CMyAppDoc::MyFunction() 
    {
       return; 
    }
    

See Also

Concepts

List Members

Other Resources

Using IntelliSense