C# 的注释继承(实际上是任何语言) [英] Comment Inheritance for C# (actually any language)
本文介绍了C# 的注释继承(实际上是任何语言)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有这个接口
public interface IFoo
{
///<summary>
/// Foo method
///</summary>
void Foo();
///<summary>
/// Bar method
///</summary>
void Bar();
///<summary>
/// Situation normal
///</summary>
void Snafu();
}
还有这个班
public class Foo : IFoo
{
public void Foo() { ... }
public void Bar() { ... }
public void Snafu() { ... }
}
有没有办法,或者有什么工具可以让我在基类或接口中自动放入每个成员的注释?
Is there a way, or is there a tool that can let me automatically put in the comments of each member in a base class or interface?
因为我讨厌为每个派生的子类重写相同的注释!
Because I hate re-writing the same comments for each derived sub-class!
推荐答案
GhostDoc正是这样.对于未继承的方法,它会尝试根据名称创建描述.
GhostDoc does exactly that. For methods which aren't inherited, it tries to create a description out of the name.
FlingThing()
变成了 Flings the Thing"
这篇关于C# 的注释继承(实际上是任何语言)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文