c# - 在泛型类中注释构造函数的正确方法是什么?

标签 c# visual-studio visual-studio-2010 stylecop xml-documentation

什么是正确的评论方式?

/// <summary>
/// Initializes a new instance of the <see cref="Repository"/> class.
/// </summary>
/// <param name="unitOfWork">The unit of work.</param>
public Repository(IUnitOfWork unitOfWork)
{
    this.UnitOfWork = unitOfWork;
}

VS 提示它:

Warning 11 XML comment on 'Data.Repository.Repository(Data.IUnitOfWork)' has cref attribute 'Repository' that could not be resolved C:\Projects\xx\yy\DataAccess\Repository.cs 35 58 Data

最佳答案

你需要使用花括号:

/// <summary>
/// Initializes a new instance of the <see cref="Repository{T}"/> class.
/// </summary>

对于每个 typeparam,只需在大括号中添加一个附加值,用逗号分隔。

关于c# - 在泛型类中注释构造函数的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6868138/

相关文章:

c# - decimal.TryParse 乐于接受格式错误的数字字符串

c# - 在大于 5000x3000 的桌面上绘制单个移动图像的最快方法?

c++ - 在opencv中使用静态库而不是动态库

c - Visual Studio 2010 在尝试调试时给我语法错误,但没有语法错误!

c# - 为什么我的自定义控件的文本属性不会显示在“属性”窗口中?

C# 如何为 selectedValue = null 设置 dropDownList 默认值

c# - 移动 Azure 服务 C# .NET 后端补丁未更新

visual-studio - .NET 5 在 Visual Studio 2019 中不可用

.net - JIT Debugger only 选项是 Visual Studio 的新实例

.net - 如何将一列添加到 rdlc 的数据集中并让它出现在报告中以供使用?