Reference generic comment

I was wondering if it is possible to reference a dynamic generic class name in a comment and have it conditionally resolved in the IDE?

Simple base class example:

// <summary>
// Retrieves all <T> members from the database.
// </summary>
public void GetAll<T>()
{
 //magic
}

If I now inherit from this class and happens to be class User then I'd like to have IntelliSense show my comment as "Retrieves all User members from the database".

Is this possible?


There's no way of getting Intellisense to automatically write the name of the generic type used for your specific call. The best you can do is use the typeparamref tag, which indicates to Visual Studio (and more importantly any docmentation generator) that you are referring to a generic type parameter ( T in this case).

// <summary>
// Retrieves all <typeparamref name="T"/> members from the database.
// </summary>
public void GetAll<T>()
{
    //magic
}
链接地址: http://www.djcxy.com/p/42660.html

上一篇: 如何为我的团队重新包装日食

下一篇: 参考通用评论