问题
My code contains a class with one method that returns an object that was originally passed as a parameter to another method. I would like to indicate this relationship in the XML documentation mark-up.
class XmlDocThing
{
/// <summary>
/// Documentation for the other method.
/// </summary>
/// <param name="howDoIReferToThis">Magic object.</param>
public void AnotherMethod(object howDoIReferToThis) { }
/// <summary>
/// Documentation for this method.
/// </summary>
/// <returns>The object passed as the <paramref name="howDoIReferToThis"/>
/// argument of the <see cref="AnotherMethod"/> method.</returns>
public object FromThisMethod() { return null; }
}
This results in the warning:
Warning 1 XML comment on 'MyNamespace.XmlDocThing.FromThisMethod()' has a paramref tag for 'howDoIReferToThis', but there is no parameter by that name
The <see cref="AnotherMethod"/>
element to do the method reference works as expected, but <paramref>
doesn't appear to have a cref
attribute (which only seems to apply to method and property members anyway), or any equivalent.
Is this even possible, and if so, how?
来源:https://stackoverflow.com/questions/37433603/how-do-i-reference-parameters-to-other-methods-in-xml-documentation