このインターフェースがあるとします
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() { ... }
}
基本クラスまたはインターフェースの各メンバーのコメントを自動的に入力できる方法またはツールはありますか?
派生したサブクラスごとに同じコメントを書き直すのが嫌だからです。
ベストアンサー1
次のタグはいつでも使用できます<inheritdoc />
:
public class Foo : IFoo
{
/// <inheritdoc />
public void Foo() { ... }
/// <inheritdoc />
public void Bar() { ... }
/// <inheritdoc />
public void Snafu() { ... }
}
属性を使用するとcref
、まったく異なるクラスまたは名前空間内のまったく異なるメンバーを参照することもできます。
public class Foo
{
/// <inheritdoc cref="System.String.IndexOf" />
public void Bar() { ... } // this method will now have the documentation of System.String.IndexOf
}