开发者

Can Resharper Copy XML Comments from Base Class

I have a class that i am inheri开发者_如何学Cting from and the methods i override should have the same comments as the base. Does resharper have an option to copy them?


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.

Can Resharper Copy XML Comments from Base Class


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.


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


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.


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.


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜