What's the proper way to comment this?
/// <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 complains about it:
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
A generic constructor is a constructor that has at least one parameter of a generic type. We'll see that generic constructors don't have to be in a generic class, and not all constructors in a generic class have to be generic.
Explanation: A constructor is a simple method which has the same name as the class and hence used to create object of a class.
The calling of the constructor can be done in two ways: By using this() keyword: It is used when we want to call the current class constructor within the same class. By using super() keyword: It is used when we want to call the superclass constructor from the base class.
You need to use curly braces:
/// <summary> /// Initializes a new instance of the <see cref="Repository{T}"/> class. /// </summary>
For each typeparam
, just add an additional value in the braces, delimited with a comma.
StyleCop has defined how it should look like.
If the class contains generic parameters, these can be annotated within the cref link using either of the following two formats:
/// <summary> /// Initializes a new instance of the <see cref="Customer`1"/> class. /// </summary> public Customer() { } /// <summary> /// Initializes a new instance of the <see cref="Customer{T}"/> class. /// </summary> public Customer() { }
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