Use Lists And Tables In .NET Xml Source Comments

As well as text and links (<see/> elements), you can use bullet lists, definition lists and also tables in Xml Source Comments. Here are some examples:

Bullet List

Source Comment

/// <summary>
/// This summary contains a bullet list:
/// <list type="bullet">
/// <item><description>This is the first bullet</description></item>
/// <item><description>This is the second bullet</description></item>
/// </list>
/// </summary>
public class Class1
{
}

Output

This summary contains a bullet list:

  • This is the first bullet
  • This is the second bullet

Numbered List

Source Comment

/// <summary>
/// This summary contains a numbered list:
/// <list type="number">
/// <item><description>This is the first item</description></item>
/// <item><description>This is the second item</description></item>
/// </list>
/// </summary>
public class Class2
{
}

Output

This summary contains a numbered list:

  1. This is the first item
  2. This is the second item

Definition List

Source Comment

/// <summary>
/// This comment contains a definition list:
/// <list type="termdef">
/// <item>
/// <term>Term Caption</term>
/// <description>Term Description.</description>
/// </item>
/// <item>
/// <term>Term Caption 2</term>
/// <description>Term Description 2.</description>
/// </item>
/// </list>
/// </summary>
public class Class3
{
}

Output

This comment contains a definition list:

Term Caption
Term Description.
Term Caption 2
Term Description 2.

Table

Source Comment

/// <summary>
/// This comment contains a table
/// <list type="table">
/// <listheader>
/// <term>Header 1</term>
/// <term>Header 2</term>
/// <term>Header 3</term>
/// </listheader>
/// <item>
/// <term>Cell 1</term>
/// <term>Cell 2</term>
/// <term>Cell 3</term>
/// </item>
/// </list>
/// </summary>
public class Class4
{ 
}

Output

This comment contains a table

Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3

 

 

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.