Ale*_*lex 7 c# intellisense xml-documentation xml-comments visual-studio
我想知道是否可以在注释中引用动态泛型类名称并在IDE中有条件地解决它?
简单的基类示例:
// <summary>
// Retrieves all <T> members from the database.
// </summary>
public void GetAll<T>()
{
//magic
}
Run Code Online (Sandbox Code Playgroud)
如果我现在从这个类继承而恰好是类User,那么我想让IntelliSense将我的评论显示为"从数据库中检索所有用户成员".
这可能吗?
无法让 Intellisense 自动写入用于特定调用的泛型类型的名称。您能做的最好的事情就是使用typeparamref
标记,它向 Visual Studio(更重要的是任何文档生成器)表明您正在引用泛型类型参数(T
在本例中)。
// <summary>
// Retrieves all <typeparamref name="T"/> members from the database.
// </summary>
public void GetAll<T>()
{
//magic
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
497 次 |
最近记录: |