Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 817
Alex Avatar asked May 30 '09 23:05

Alex


1 Answers

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
}
like image 124
Noldorin Avatar answered Sep 20 '22 00:09

Noldorin