다음을 통해 공유


<summary>(C# 프로그래밍 가이드)

<summary>description</summary>

매개 변수

  • description
    개체에 대한 요약입니다.

설명

형식 또는 형식 멤버를 설명하려면 <summary> 태그를 사용해야 합니다. 형식에 대한 설명을 보충하는 정보를 추가하려면 <remarks>를 사용합니다. Sandcastle과 같은 문서 도구를 사용하여 코드 요소의 문서 페이지에 대한 내부 하이퍼링크를 만들 수 있게 하려면 cref 특성을 사용합니다.

IntelliSense에서 <summary> 태그의 텍스트는 형식 정보의 유일한 출처이며, Object Browser Window에서도 표시됩니다.

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

앞의 예제는 다음과 같은 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>

다음 예제에서는 제네릭 형식에 대한 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> { }

앞의 예제는 다음과 같은 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>

참고 항목

참조

문서 주석에 대한 권장 태그(C# 프로그래밍 가이드)

개념

C# 프로그래밍 가이드