views:

105

answers:

1

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?

+8  A: 

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>
Mark Byers