VB.NET XML Documentation

Overview

XML documentation comments provide a way to describe the public API of your VB.NET code. They are processed by the compiler to generate .xml documentation files and can be displayed in IntelliSense, MSDN style help pages, or custom documentation generators.

Supported Tags

TagDescriptionExample
<summary> Brief description of the member. '<summary>Calculates the sum of two numbers.</summary>
<param name="..."/> Describes a method parameter. '<param name="x">First integer.</param>
<returns> Describes the return value. '<returns>The sum of x and y.</returns>
<remarks> Additional information. '<remarks>This method does not perform overflow checking.</remarks>
<example> Provides a code example. '<example> Dim result = Add(1,2) Console.WriteLine(result) </example>
<exception cref="..."/> Documents exceptions thrown. '<exception cref="ArgumentNullException">When value is null.</exception>
<see cref="..."/> Creates a hyperlink to another member. '<see cref="String.Trim"/>
<seealso cref="..."/> Provides a related link. '<seealso cref="Math.Max"/>

Sample VB.NET Code

'<summary>
'    Adds two integer values.
'</summary>
'<param name="a">First integer.</param>
'<param name="b">Second integer.</param>
'<returns>The sum of a and b.</returns>
Public Function Add(a As Integer, b As Integer) As Integer
    Return a + b
End Function

Generating Documentation Files

Compile your project with the /doc switch (or enable XML documentation file in the project properties) to produce an .xml file alongside the assembly.

csc /target:library /doc:MyLibrary.xml MyLibrary.vb

Further Reading