<summary> (Przewodnik programowania w języku C#)

<summary>description</summary>

Parametry

  • description
    Podsumowanie obiektu.

Uwagi

<summary> znacznik stosuje się do opisu typu lub członka typu.Użyj <remarks> dodać informacje uzupełniające do opisu typu.Użyj atrybut cref umożliwiające dokumentacji narzędzia, takie jak Sandcastle do tworzenia hiperłączy wewnętrznych do stron dokumentacji dla elementów kodu.

Tekst dla <summary> Tag jest jedynym źródłem informacji o typie w technologii IntelliSense i jest wyświetlany w Object Browser Window.

Kompiluj z /doc do procesu komentarzy dokumentacji do pliku.Aby utworzyć ostatniej dokumentacji, na podstawie plików generowanych przez kompilator, można tworzyć niestandardowe narzędzie, lub użyć narzędzia, takie jak Sandcastle.

Przykład

// 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()
    {
    }
}

Poprzedni przykład daje następujący plik XML.

<?xml version="1.0"?>
<doc>
    <assembly>
        <name>YourNamespace</name>
    </assembly>
    <members>
        <member name="T:DotNetEvents.TestClass">
            text for class TestClass
        </member>
        <member name="M:DotNetEvents.TestClass.DoWork(System.Int32)">
            <summary>DoWork is a method in the TestClass class.
            <para>Here's how you could make a second paragraph in a description. <see cref="M:System.Console.WriteLine(System.String)"/> for information about output statements.</para>
            <seealso cref="M:DotNetEvents.TestClass.Main"/>
            </summary>
        </member>
        <member name="M:DotNetEvents.TestClass.Main">
            text for Main
        </member>
    </members>
</doc>

Poniższy przykład ilustruje sposób cref odwołanie do typu rodzajowego.

// 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> { }

Poprzedni przykład daje następujący plik XML.

<?xml version="1.0"?>
<doc>
    <assembly>
        <name>YourNamespace</name>
    </assembly>
    <members>
        <member name="T:ExtensionMethodsDemo1.A">
            <summary cref="T:ExtensionMethodsDemo1.C`1">
            </summary>
        </member>
        <member name="T:ExtensionMethodsDemo1.B">
            <summary cref="T:C`1">
            </summary>
        </member>
        <member name="T:ExtensionMethodsDemo1.C`1">
            <summary cref="T:ExtensionMethodsDemo1.A">
            </summary>
            <typeparam name="T"></typeparam>
        </member>
    </members>
</doc>

Zobacz też

Informacje

Znaczniki zalecane dla komentarzy do dokumentacji (Przewodnik programowania w języku C#)

Koncepcje

Przewodnik programowania w języku C#