C
C#17mo ago
Developful

❔ Getting documentation from another class and putting it in another one

Title is probably very confusing, but I'm asking if theres a way to do this
/// <summary>
/// This is Class A;
/// </summary>
class A { }

/// grab Class A's documentation
class B { }
/// <summary>
/// This is Class A;
/// </summary>
class A { }

/// grab Class A's documentation
class B { }
so basically if i hover over B, it'll show me A's documentation i also don't wanna copy paste in case I make changes to A's documentation
11 Replies
Thinker
Thinker17mo ago
/// <inheritdoc cref="A"/>
/// <inheritdoc cref="A"/>
I think
Pobiega
Pobiega17mo ago
^
Developful
DevelopfulOP17mo ago
that works, tysm
Pobiega
Pobiega17mo ago
Thinker nailed it
Azrael
Azrael17mo ago
Is cref="ref" necessary? What happens if you don't include it?
Thinker
Thinker17mo ago
cref="ref" indicates what to inherit the doc from
Azrael
Azrael17mo ago
I know. But is it necessary?
Thinker
Thinker17mo ago
If you want to inherit the doc from something which isn't the parent class, yes
Azrael
Azrael17mo ago
Alright.
Coehl
Coehl17mo ago
Or if it's a class with one interface and no parent, it can inherit from that without it
Accord
Accord17mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?