DLauer
DLauer

Reputation: 1302

How do I put code examples in .NET XML comments?

What tags can I use for putting code examples in .NET /// XML comments?

Upvotes: 8

Views: 1792

Answers (2)

Jason Evans
Jason Evans

Reputation: 29186

Try using the <example> tag.

/// <example>
/// <code>
/// // create the class that does translations
/// GiveHelpTransforms ght = new GiveHelpTransforms();
/// // have it load our XML into the SourceXML property
/// ght.LoadXMLFromFile(
///  "E:\\Inetpub\\wwwroot\\GiveHelp\\GiveHelpDoc.xml");
/// </code>
/// </example>

I got the above example from here.

Upvotes: 16

Christian C. Salvad&#243;
Christian C. Salvad&#243;

Reputation: 827238

You can use the <example> and <code> tags.

Check the Recommended Tags for Documentation Comments.

Upvotes: 6

Related Questions