引用XML代码注释中的泛型类型 [英] reference to generic type in XML code comment

查看:199
本文介绍了引用XML代码注释中的泛型类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,在C#类型/方法的XML注释中,可以在标签中引用通用类型,如下所示:

  ///< see cref =name.space.typename& lt; T& rt;(paramtype)> 

但是我觉得还有另一种语法,比较笨拙?有些东西,要摆脱那些html实体的''?我现在找不到。有人可以帮忙吗

解决方案

这是一篇关于文档的好文章: C#XML文档注释常见问题


编译器团队决定通过允许替代语法
在doc注释中引用通用类型和方法
来提高
。具体来说,
而不是使用开启和关闭
的尖括号,使用
打开和关闭花括号是合法的。然后,上面的
示例将变为:




  class Program 
{
///< summary>
/// DoSomething需要一个< see cref =List {T}/>
///< / summary>
void DoSomething(List< int> al){}
}

在你的情况下:

  ///< see cref =name.space.typename {T}(paramtype) /> 


As I know, in a XML comment for a C# type/method, it is possible to reference a generic type in a tag like so:

///<see cref="name.space.typename&lt;T&rt;(paramtype)">

But I think, there was another syntax, which is less clumsy? Something, to get rid of those html entities '<'? I cannot find it right now. Can somebody help?

解决方案

Here's a good article on documentation: C# XML documentation comments FAQ

The compiler team decided to improve this by allowing an alternate syntax to refer to generic types and methods in doc comments. Specifically, instead of using the open and close angle-brackets it’s legal to use the open and close curly braces. The example above would then become:

class Program
{
    /// <summary>
    /// DoSomething takes a <see cref="List{T}"/>
    /// </summary>
    void DoSomething(List<int> al) { }
}

So, in your case:

///<see cref="name.space.typename{T}( paramtype )" />

这篇关于引用XML代码注释中的泛型类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆