Can I propagate XML documentation from an interfac

2020-02-13 07:21发布

问题:

I need to propagate XML documentation from a base class to derivative(s) or from an interface to implementation(s).

Can I do this using Resharper?

回答1:

Yes you can.

If you're yet to implement/override members, then in a derived class or interface implementation, click Alt+Ins, choose "Overriding members" or "Implement missing members". In the wizard that displays afterwards, choose members to implement/override, and make sure to select "Copy XML documentation".

Alternatively, if you already have an overridden or implemented member in place, press Alt+Enter on the overridden/implemented member, and select "Copy comments from base".



回答2:

Starting from 2016.2 EAP 9, ReSharper supports the <inheritdoc /> tag (RSRP-33352). You will see the accumulated documentation using QuickDoc (default on Ctrl+Shift+F1).

The Members Generation option page has been extended by another option to automatically add that tag to any generated member. You will also have a context action on members, which don't have a documentation yet.

I can also recommend the XmlDoc Inspections plugin, which is somehow related to the topic.