当编写xml文档时,您可以使用<see cref="something">something</see>,这当然是有效的。但是如何使用泛型类型引用类或方法呢?

public class FancyClass<T>
{
  public string FancyMethod<K>(T value) { return "something fancy"; }
}

如果我要在某个地方编写xml文档,我该如何引用这个奇特的类呢?我怎么能引用一个幻想类<字符串>?方法呢?

例如,在一个不同的类中,我想让用户知道我将返回一个FancyClass<int>的实例。我怎么能做一个see cref的东西?


当前回答

/// <summary>Uses a <see cref="FancyClass{T}" /> instance.</summary>

顺便说一句,它出现在。net Framework 2.0和3.0的MSDN文档中,但在3.5版本中消失了

其他回答

/// <see cref="FancyClass&lt;T>.FancyMethod&lt;K>(T)"/> for more information.

从Lasse和T.B.C的回答来看:

/// <see cref="T:FancyClass`1{T}"/> for more information.

/// <see cref="M:FancyClass`1{T}.FancyMethod`1{K}(T)"/> for more information.

也会正确地提供工具提示,而他们的版本用花括号呈现。

引用方法:

/// <see cref="FancyClass{T}.FancyMethod{K}(T)"/> for more information.
/// Here we discuss the use of <typeparamref name="TYourExcellentType"/>.
/// <typeparam name="TYourExcellentType">Your exellent documentation</typeparam>
/// <summary>Uses a <see cref="FancyClass{T}" /> instance.</summary>

顺便说一句,它出现在。net Framework 2.0和3.0的MSDN文档中,但在3.5版本中消失了