如何在Visual Studio中将<或>添加到摘要标记?

Ton*_*ony 5 comments visual-studio-2008

如何在visual studio中为摘要注释添加<(小于)或>(大于)?我在Visual Studio 2008中.

我有一个通用的方法:

public bool IsMemberProtected<T>(Expression<Func<T, object>> expression)
Run Code Online (Sandbox Code Playgroud)

很想拥有这样的概要标签

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

但是当我这样做时,当开发人员在代码中的方法上悬停以查看摘要标记时,属性的工具提示不再有效.

思考?

Mar*_*ers 10

您可以使用实体&lt;&gt;给予<>分别.

请注意,在这里您还使用<>编写泛型类型.在这种情况下,有一个约定,如果你使用cref标签,那么你可以使用GenericType{T}而不是丑陋GenericType&lt;T&gt;.有关更多信息,请参见此处

另外从该页面还有另外一个建议,如果你有写了很多<>你把文本在CDATA节符号:

/// <summary>
/// This a simple collection which implements <see cref="IEnumerable{T}" />
/// </summary>
/// <example>
/// <![CDATA[
/// SimpleList<int> intList = new SimpleList<int>();
/// ]]>
/// </example>
Run Code Online (Sandbox Code Playgroud)