如何在 xml 文档中引用泛型类和方法 [英] How to reference generic classes and methods in xml documentation

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

问题描述

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

When writing xml documentation you can use <see cref="something">something</see>, which works of course. But how do you reference a class or a method with generic types?

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

如果我要在某处编写 xml 文档,我将如何引用这个花哨的类?如何引用 FancyClass?方法呢?

If I was going to write xml documentation somewhere, how would I reference the fancy class? how can I reference a FancyClass<string>? What about the method?

例如,在另一个类中,我想让用户知道我将返回 FancyClass 的一个实例.我怎么能为此制作一个查看 cref 的东西?

For example in a different class I wanted to let the user know that I will return an instance of FancyClass<int>. How could I make a see cref thing for that?

推荐答案

引用方法:

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

这篇关于如何在 xml 文档中引用泛型类和方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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