简体   繁体   中英

C# method parameter XML-documentation issue

Assume, i have a method which parameters are classes with already defined documentation:

/// <summary>
///     Get criterion from table.
/// </summary>
/// <param name="plySide"></param>
/// <param name="criterionType"></param>
/// <returns></returns>
public Criterion GetCriterion(PlySide plySide, CriterionType criterionType)
{
   // some code
}

PlySide class has it's own xml-documentation:

/// <summary>
///     Sides of monoply.
/// </summary>
public enum PlySide
{
   // some code
}

As you can see in GetCriterion method i didn't define any doc for the plySide param tag. My question is should i duplicate description of a parameter or should i remove param tags?

You shouldn't duplicate it but give a context aware description of the parameter. In your case it could be something like this (perhaps it's toally wrong, but I don't know the implementation and intention of your method):

/// <summary>
///     Get criterion from table.
/// </summary>
/// <param name="plySide">Monopoly side to get criterion for</param>
/// <param name="criterionType">Criterion to get for the given monopoly side</param>
/// <returns></returns>
public Criterion GetCriterion(PlySide plySide, CriterionType criterionType)
{
   // some code
}

The PlySide documentation will describe what the type is .

The plySide documentation should describe what role that parameter plays within the GetCriterion method.

Those will usually be subtly (or not so subtly) different.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM