Link to general comment

I was wondering if it is possible to refer to the dynamic name of a common class in a comment and is it allowed in the IDE?

An example of a simple base class:

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

If I now inherit from this class and, it turns out, is the User class, then I would like IntelliSense to show my comment as "Retrieves all users from the database."

Is it possible?

+7
c # visual-studio intellisense xml-comments xml-documentation
source share
1 answer

There is no way to force Intellisense to automatically record the generic type name used for your specific call. The best you can do is use the typeparamref tag that Visual Studio (and, more importantly, any documentation generator) points to, which you refer to a typical type parameter ( T in this case).

 // <summary> // Retrieves all <typeparamref name="T"/> members from the database. // </summary> public void GetAll<T>() { //magic } 
+4
source share

All Articles