views:

56

answers:

5

I am trying to write documentation comments however I have a problem.

/// <summary>
/// Inserts an element into the System.Collections.Generic.List<T> at the specified
/// index.
/// </summary>

When I reach the <T> Visual studio thinks I am trying to add another tag. what is the correct way to add comments like that (and if I could make them click able in the generated help text that would be a extra bonus)

A: 

Since the comment is xml you can use appropriate escape sequences for xml:

/// Inserts an element into the System.Collections.Generic.List&lt;T&gt; at the specified 
Aurril
+2  A: 

escape the xml entities.

Change <T> into &lt;T&gt;
Marvin Smit
+8  A: 

C# documentation comments are XML, so change your < and > to &lt; and &gt;.

What you're better off doing, though is, is using the <see> tag to insert a hyperlink. In a <see> tag, change <T> to {T}:

/// <summary>
/// Inserts an element into the <see cref="List{T}"/> at the specified
/// index.
/// </summary>

(Note that the cref attribute is syntax-checked by the compiler, unlike ordinary text.)

Tim Robinson
+1  A: 

I believe this would be of help for you: C# XML documentation comments FAQ.

andras
Thanks, I always love a well written FAQ
Scott Chamberlain
I'm glad if it helps - it certainly has proved useful to me at times.
andras
A: 

You need to use the proper char codes: &lt; and &gt;.

You would want to surreound the whole System.Collections.Generic.List<T> in a <see cref="..."/> tag.

I actually had to use the above mentioned tags to correctly write this answer :)

slugster