Resharper 可以从基类复制 XML 注释吗
我有一个继承自的类,并且我重写的方法应该具有与基类相同的注释。 resharper 是否可以选择复制它们?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
除了上面提到的上下文操作(我发现对每个继承成员应用相当繁琐)之外,您还可以将 ReSharper 配置为在实现基类或接口时默认“下拉”注释。
为此,请从 ReSharper 主菜单转到
Options |代码编辑 |会员生成|此处的其他选项
您将看到一个从覆盖的成员复制 XML 文档的选项,如果您选中此选项,ReSharper 将自动为您复制所有继承的文档。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.从 ReSharper 3.0 版开始,您应该有一个上下文操作来执行此操作, 复制基地评论。如果它似乎不可用,请确保在 ReSharper | 中选中它。选项|语言 | C# |上下文操作。
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
.让您重写的方法取消注释。因此,R# 简短帮助(Ctrl+Shift+F1)将自动显示基类成员的帮助。
Let your overridden methods uncommented. So R# short help (Ctrl+Shift+F1) will automatically show the help of base class member.
这是 我可以将 XML 文档从接口传播到它的实现?
答案:按Alt+Ins 从每个方法名称中选择“从库复制注释”。正如接受的答案所示,您必须启用此选项。
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.
这是一个较旧的问题,但我想我会添加一点,resharper 支持标签
,这样界面的注释也会显示在智能感知的工具提示中。
This is an older question, but I thought I'll add the point that resharper has support for the tag
With this it the comment of the interface is also shown in the tooltip in intellisense.
我构建了一个工具来后处理 XML 文档文件,添加了对的支持。标签。
虽然它对源代码中的 Intellisense 没有帮助,但它确实允许将修改后的 XML 文档文件包含在 NuGet 包中,因此可以在引用的 NuGet 包中使用 Intellisense。
请访问 www.inheritdoc.io 了解更多信息(提供免费版本)。
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).