Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to inherit documentation from specific parameters?

Visual Studio 2017, ReSharper 2017, C# project

I am trying to inherit the documentation of a method's parameter by using the select attribute, but it doesn't seem to work as expected.

According to this article ( http://tunnelvisionlabs.github.io/SHFB/docs-master/SandcastleBuilder/html/79897974-ffc9-4b84-91a5-e50c66a0221d.htm ) documentation can be filtered using the select attribute, and one of the examples show it being used as such:

 /// <example>
 /// <inheritdoc cref="MethodWithTwoExamples"
 ///     select="span[@id='Example 2']" />
 /// </example>

So in a similar fashion I try to filter the documentation this way:

/// <param name="generateStream"><inheritdoc cref="MyClass.MyMethod" select="param[@name='generateStream']"/></param>

but the problem with it is that Visul Studio Intellisense doesn't display the documentation of that specific parameter, but instead it shows the documentation of the first parameter of the method I'm trying to inherit the documentation from.

So my question is: is it possible to filter documentation down to a specific parameter of a method?

like image 459
IneedHelp Avatar asked Sep 30 '17 15:09

IneedHelp


People also ask

What is XML comments in c#?

The XML comments are used to build API documentation which is readable by external tools. IntelliSense also reads these, and uses the contents to show the docs for your code in the assistance tooltips as you type (and in the Documentation window).

What does inherit doc mean?

It means "Inherit all the documentation and add more to it"

What is cref in c#?

The cref attribute in an XML documentation tag means "code reference." It specifies that the inner text of the tag is a code element, such as a type, method, or property.


1 Answers

What you are asking for is possible with Visual Studio 2019 (16.9.3). I had the same problem myself and found a discussion here:

https://github.com/doxygen/doxygen/issues/7356/#issuecomment-547905295

which pointed me to the right direction.

  • First, as select is deprecated, you have to use path instead.

  • Second, you have to prefix the XPath part with a slash (/) so that your XML doc will look like this:

    /// <param name="generateStream"><inheritdoc cref="MyClass.MyMethod" path="/param[@name='generateStream']"/></param>
    
like image 180
markus s Avatar answered Nov 09 '22 12:11

markus s