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

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

问题描述

据我所知,在C#类型/方法的XML注释,有可能引用泛型类型的标签,像这样:

  ///<见CREF =name.space.typename&放大器; LT; T&安培;室温;(paramtype)> 



不过,我认为,有另一种语法,这是少笨拙?东西,要摆脱那些HTML实体的'<'?现在我找不到它。有人能帮忙吗?


解决方案

下面的文档上的好文章:的C# XML文档注释FAQ




编译器团队决定通过允许替代语法
指泛型类型和方法
在文档注释提高
本。具体来说,
而不是使用开启和关闭
角括号是合法的使用
打开和关闭大括号内。在
上面的例子随后将变成:




 类节目
{
///<总结>
/// DoSomething的需要<见CREF =列表【T】/>
///< /总结>
无效DoSomething的(名单< INT>人){}
}



所以, ,你的情况:

  ///<见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天全站免登陆