This project has moved. For the latest updates, please go here.

<examaple> tag help needed

Topics: Developer Forum, User Forum
Feb 2, 2008 at 9:53 PM
I am commenting my c# code, for example:
/// <example>
/// <code>
/// GiveHelpTransforms ght = new GiveHelpTransforms();
/// ght.LoadXMLFromFile("E:\\Inetpub\\wwwroot\\GiveHelp\\GiveHelpDoc.xml");
/// </code>
/// </example>
In the output HELP file the Example section showns only for C#, how one would modify XML comments so that to include examples for other languages too?

<example language="C#"><code>C# Text goes here</code></example>
<example language="VB.NET#"><code>VB.NET Text goes here</code></example>

Feb 3, 2008 at 1:08 AM
Use a lang attribute on the code tag rather than a language attribute on the example tag:

<example><code lang="cs">C# Text goes here</code></example>
<example><code lang="vbnet">VB.NET Text goes here</code></example>

See the Code Block Component documentation in the help file for the language IDs that can be used and other extension attributes available on the <code> tag that the code block component supplies. For a comprehensive guide to XML comments, see

Feb 3, 2008 at 2:12 PM
Thank you for your reply. That guide is indeed a very good Help.
Feb 15, 2008 at 4:32 PM
Edited Feb 15, 2008 at 4:37 PM
I am doing something similar. I want to show C# and VB code samples. I am pulling the code from a separate file by using the <include> tag in the source code file.

The default is C#. I want to modify something in my SC project rather than add lang=vbnet to hundreds of code snippets. How do I do that?


PS. Excellent tool and documentation.
Feb 15, 2008 at 6:17 PM
There isn't a way to differentiate between languages without marking the <code> tags. The component can only assume one default language.

Feb 19, 2008 at 3:56 PM
Use Search/Replace in Visual Studio to do the change across multiple files.
You'll still have to manually decide which ones to replace, but at least you won't have to type so much.