次の方法で共有


<summary> (C# プログラミング ガイド)

<summary>description</summary>

パラメーター

  • description
    オブジェクトの要約。

解説

<summary> タグは、型または型のメンバーの説明に使用します。 型の説明に補足情報を追加するには、<remarks> タグを使用します。 Sandcastle などのドキュメント ツールを有効にして、コード要素のドキュメント ページへの内部ハイパーリンクを作成するには、cref 属性を使用します。

<summary> タグのテキストは、IntelliSense で、型に関する唯一の情報源になり、オブジェクト ブラウザー にも表示されます。

コンパイル時に /doc を指定してドキュメント コメントをファイルに出力します。 コンパイラによって生成されたファイルに基づいて最終的なドキュメントを作成するには、カスタム ツールを作成するか、Sandcastle などのツールを使用します。

使用例

// compile with: /doc:DocFileName.xml 

/// text for class TestClass
public class TestClass
{
    /// <summary>DoWork is a method in the TestClass class.
    /// <para>Here's how you could make a second paragraph in a description. <see cref="System.Console.WriteLine(System.String)"/> for information about output statements.</para>
    /// <seealso cref="TestClass.Main"/>
    /// </summary>
    public static void DoWork(int Int1)
    {
    }

    /// text for Main
    static void Main()
    {
    }
}

ジェネリック型への cref 参照を作成する方法を次の例に示します。

// compile with: /doc:DocFileName.xml 

// the following cref shows how to specify the reference, such that,
// the compiler will resolve the reference
/// <summary cref="C{T}">
/// </summary>
class A { }

// the following cref shows another way to specify the reference, 
// such that, the compiler will resolve the reference
// <summary cref="C &lt; T &gt;">

// the following cref shows how to hard-code the reference
/// <summary cref="T:C`1">
/// </summary>
class B { }

/// <summary cref="A">
/// </summary>
/// <typeparam name="T"></typeparam>
class C<T> { }

参照

参照

ドキュメント コメント用の推奨タグ (C# プログラミング ガイド)

概念

C# プログラミング ガイド