Home > Software design >  inheritdoc for individual parameter?
inheritdoc for individual parameter?

Time:10-24

I want to use inheritdoc to grab the description of a parameter. So I have:

/// <param name="nameOfParameter">parameter description</param>
MethodName(int nameOfParameter)`
...
/// <summary>
/// <inheritdoc cref="ClassName.MethodName" select="param[@name='nameOfParameter']" />
/// </summary>
AnotherFunc

But AnotherFunc now has the description of MethodName rather than the parameter. Is this possible?

CodePudding user response:

It seems that the select attribute is no longer used in inheritdoc tag. Use path instead:

/// <summary>
/// <inheritdoc cref="ClassName.MethodName" path="/param[@name='nameOfParameter']" />
/// </summary>
void AnotherFunc() { }

UPDATE

The xpath above will also include the inherited <param> tag itself inside the <summary> tag. It's not visible in the Intellisense quick info. But the more appropriate xpath should insert just the contents of the inherited <param> tag:

/// <summary>
/// <inheritdoc cref="MethodName" path="//param[@name='nameOfParameter']/node()" />
/// </summary>
void AnotherFunc() { }
  • Related