views:

74

answers:

1

Hi, 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?

+1  A: 

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
}
Noldorin