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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With