XML 注释中有引用类型参数的 cref 特性“attribute”
如果在代码中使用含有对类型参数而非现有类型(无论是用户定义的,还是内置的)的交叉引用 (cref) 的 <see/> 标记,则会为 XML 注释生成此错误。 无法链接到泛型类型的“attribute”,因为在创建文档时,未来指定为“attribute”的类型尚不得而知。
若要解决此问题,应使用 <typeparamref/> 标记。
示例
以下示例包含生成 CS1723 的注释以及可以正确链接的引用。
public class Point
{
}
// compile with: /t:library /doc:filename.XML
///<summary>A generic list class.</summary>
///uses <see cref="T" /> // CS1723
///and <see cref="Point" /> // No warning
public class List<T, Point>
{
}
此示例展示了如何正确链接泛型类型 T
和已知的用户定义的 Point
public class Point
{
}
// compile with: /t:library /doc:filename.XML
///<summary>A generic list class.</summary>
///uses <typeparamref name="T" /> // No warning
///and <see cref="Point" /> // No warning
public class List<T, Point>
{
}