Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you add < or > to a summary tag in Visual studio?

How do you add < (less than) or > (greater than) to a summary comment in visual studio? I am in Visual Studio 2008.

I have a generic method:

public bool IsMemberProtected<T>(Expression<Func<T, object>> expression)

Would love to have a summary tag of something like this

    /// <summary>
    /// Determines whether a member is protected.
    /// 
    /// Usage: IsMemberProtected<ExampleType>(x => x.Member)
    /// </summary>

But when I do that, the tooltip for the property no longer works when a developer hovers over the method in code to view the summary tag.

Thoughts?

like image 691
Tony Avatar asked Apr 05 '10 14:04

Tony


2 Answers

You can use the entities &lt; and &gt; to give < and > respectively.

Notice that here you also use < and > to write a generic type. In this case there is a convention that if you use a cref tag then you can use GenericType{T} instead of the uglier GenericType&lt;T&gt;. See here for more information.

Also from that page there is another suggestion if you have to write a lot of < and > symbols that you put the text in a CDATA section:

/// <summary>
/// This a simple collection which implements <see cref="IEnumerable{T}" />
/// </summary>
/// <example>
/// <![CDATA[
/// SimpleList<int> intList = new SimpleList<int>();
/// ]]>
/// </example>
like image 146
Mark Byers Avatar answered Nov 15 '22 03:11

Mark Byers


i think this may help you.

Right-click on the function, select "Document this" for Ex.

public void Function_Name()

becomes

/// <summary>
/// Give the details here
/// </summary>
/// <param name=""></param>
/// <returns> you can tel what it returns </returns>
public void Function_Name()

(it is all auto generated).

like image 28
Iorn Man Avatar answered Nov 15 '22 05:11

Iorn Man