Ryan Burnham
Ryan Burnham

Reputation: 2669

Can Resharper Copy XML Comments from Base Class

I have a class that i am inheriting from and the methods i override should have the same comments as the base. Does resharper have an option to copy them?

Upvotes: 7

Views: 5641

Answers (6)

K Johnson
K Johnson

Reputation: 488

I built a tool to post-process the XML documentation files adding support for the <inheritdoc/> tag.

While it doesn't help with Intellisense in source code, it does allow the modified XML documentation files to be included in a NuGet package and therefore works with Intellisense in referenced NuGet packages.

Go to www.inheritdoc.io for more info (free version available).

Upvotes: 0

NPadrutt
NPadrutt

Reputation: 4257

This is an older question, but I thought I'll add the point that resharper has support for the tag

     /// <inheritdoc />

With this it the comment of the interface is also shown in the tooltip in intellisense.

Upvotes: 1

Richard
Richard

Reputation: 1692

In addition to the above mentioned context action, which I find fairly tedious to apply for each inherited member, you can also configure ReSharper to "pull down" comments by default when implementing a base class or interface.

To do this, from the ReSharper main menu go to Options | Code Editing | Member Generation | Other Options inside here you will see an option to Copy XML documentation from overridden members, if you check this option ReSharper will automatically copy all inherited documentation for you.

enter image description here

Upvotes: 19

drzaus
drzaus

Reputation: 24994

This is a duplicate of Can I propagate XML documentation from an interface to its implementation?

Answer: press Alt+Ins from each method name, choose "Copy comments from base". As accepted answer indicates, you must have this option enabled.

Upvotes: 1

brgerner
brgerner

Reputation: 4371

Let your overridden methods uncommented. So R# short help (Ctrl+Shift+F1) will automatically show the help of base class member.

Upvotes: 2

AakashM
AakashM

Reputation: 63340

Since version 3.0 of ReSharper, you should have a context action available to do this, Copy comments from base. If it doesn't appear to be available, make sure it's checked in ReSharper | Options | Languages | C# | Context Actions.

Upvotes: 9

Related Questions