다음을 통해 공유


CodeDelegate2.DocComment 속성

CodeDelegate 요소에 대한 문서 주석을 설정하고 가져옵니다.

네임스페이스:  EnvDTE80
어셈블리:  EnvDTE80(EnvDTE80.dll)

구문

‘선언
Property DocComment As String
    Get
    Set
string DocComment { get; set; }
property String^ DocComment {
    String^ get ();
    void set (String^ value);
}
abstract DocComment : string with get, set
function get DocComment () : String
function set DocComment (value : String)

속성 값

형식: System.String
문서 주석이 들어 있는 문자열입니다.

구현

CodeDelegate.DocComment

설명

DocComment는 코드에 있는 특수한 문서 주석이나 특성을 반환합니다. 코드 모델을 구현하는 언어에 문서 주석 메커니즘이 없거나 대리자와 관련된 문서 주석이나 특성이 없으면 DocComment에서 빈 문자열을 반환합니다.

참고

클래스, 구조체, 함수, 특성, 대리자 등의 코드 모델 요소를 특정한 방식으로 편집한 후에는 요소의 값이 명확하지 않을 수 있습니다. 즉, 요소의 값이 항상 같다고 할 수 없습니다. 자세한 내용은 코드 모델을 사용하여 코드 검색(Visual Basic)의 "코드 모델 요소 값이 변경될 수 있음" 단원을 참조하십시오.

예제

이 예제를 실행하기 전에 클래스가 포함된 프로젝트를 로드하고 예제 코드와 함께 다음 줄을 삽입합니다. 줄과 예제 코드가 모두 추가된 후에 Delegate 줄을 클릭하여 그 위치에 삽입 지점을 놓은 다음 예제를 실행합니다.

[VisualBasic]

Delegate Sub MySubDelegate(ByVal x As Integer)

[C#]

public delegate void MySubDelegate(int x);

[VisualBasic]

Public Sub CodeDelegateExample(ByVal dte As DTE2)
    ' Before running this example, open a code document from a 
    ' project and place the insertion point inside a class 
    ' definition.
    Try
        ' Retrieve the CodeClass at the insertion point.
        Dim sel As TextSelection = _
            CType(DTE.ActiveDocument.Selection, TextSelection)
        Dim del As CodeDelegate2 = _
            CType(sel.ActivePoint.CodeElement( _
        vsCMElement.vsCMElementDelegate), CodeDelegate2)
        Dim elem As CodeElement2
        Dim sb As New System.Text.StringBuilder

        ' Display the baseclass name of the delegate.
        sb.AppendLine("Delegate base class name: " & _
          del.BaseClass.Name)
        sb.AppendLine("Delegate's access: " & del.Access.ToString)
        sb.AppendLine("Children: " & del.Children.Count & "  _
          Name: " & del.Children.Item(1).Name)
        sb.AppendLine("Collection: " & del.Collection.Count)
        sb.AppendLine("Delegates:")
        For Each elem In del.Collection
            sb.AppendLine("    - " & elem.Name)
        Next
        sb.AppendLine("Comment: " & del.Comment)
        sb.AppendLine("Doc Comment: " & del.DocComment)
        sb.AppendLine("DTE Parent: " & del.DTE.Name)
        sb.AppendLine("Endpoint location: " & _
          del.EndPoint.AbsoluteCharOffset)
        sb.AppendLine("Infolocation: " & del.InfoLocation.ToString)
        sb.AppendLine("Can provide CodeType object? " & _
          del.IsCodeType.ToString)
        sb.AppendLine("Is Delegate derived? " & _
          del.IsDerivedFrom("EnvDTE80"))
        sb.AppendLine("Is Delegate a generic? " & del.IsGeneric)
        sb.AppendLine("Kind: " & del.Kind.ToString)
        sb.AppendLine("Authoring language: " & _
          del.Language.ToString)
        sb.AppendLine("Name: " & del.Name)
        sb.AppendLine("Namespace: " + del.Namespace.Name);
        sb.AppendLine("Parameters: " & del.Parameters.Item(1).Name)
        sb.AppendLine("Project containing the delegate: " & _
          del.ProjectItem.Name)
        sb.AppendLine("Prototype for delegate: " & del.Prototype)
        sb.AppendLine("Delegate start point offset: " & _
          del.StartPoint.LineCharOffset)
        sb.AppendLine("Type: " & del.Type.TypeKind.ToString)
        MsgBox(sb.ToString)

    Catch ex As System.Exception
        MsgBox(ex.ToString)
    End Try
End Sub

[C#]

public void CodeDelegateExample(DTE2 DTE)
{
    try
    {
        // Retrieve the CodeClass at the insertion point.
        TextSelection sel = (TextSelection) 
          DTE.ActiveDocument.Selection;
        CodeDelegate2 del = (CodeDelegate2) 
          sel.ActivePoint.get_CodeElement
          (vsCMElement.vsCMElementDelegate);
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        // Display the baseclass name of the delegate.
        sb.AppendLine("Delegate base class name: " + 
          del.BaseClass.Name);
        sb.AppendLine("Delegate's access: " + del.Access);
        sb.AppendLine("Children: "+del.Children.Count+"  Name: 
          "+del.Children.Item(1).Name);
        sb.AppendLine("Collection: "+del.Collection.Count);
        sb.AppendLine("Delegates:");
        foreach (CodeElement2 elem in del.Collection )
        {
            sb.AppendLine("    - "+elem.Name);
        }
        sb.AppendLine("Comment: "+del.Comment);
        sb.AppendLine("Attributes:"); 
        foreach (CodeElement2 elem in del.Attributes)
        {
            sb.AppendLine("    - " + elem.Name);
        }
        sb.AppendLine("Bases:");
        foreach (CodeElement2 elem in del.Bases)
        {
            sb.AppendLine("    - " + elem.Name);
        } 
        sb.AppendLine("Doc Comment: " + del.DocComment);
        sb.AppendLine("DTE Parent: "+del.DTE.Name);
        sb.AppendLine("Endpoint location: 
          "+del.EndPoint.AbsoluteCharOffset);
        sb.AppendLine("Infolocation: "+del.InfoLocation);
        sb.AppendLine("Can provide CodeType object? "+del.IsCodeType);
        sb.AppendLine("Is Delegate derived? 
          "+del.get_IsDerivedFrom("EnvDTE80"));
        sb.AppendLine("Is Delegate a generic? "+del.IsGeneric);
        sb.AppendLine("Kind: "+del.Kind);
        sb.AppendLine("Authoring language: "+del.Language);
        sb.AppendLine("Name: "+del.Name);
        sb.AppendLine("Parameters: "+del.Parameters.Item(1).Name);
        sb.AppendLine("Namespace: " + del.Namespace.Name);
        sb.AppendLine("Project containing the delegate: 
          "+del.ProjectItem.Name);
        sb.AppendLine("Delegate start point offset: 
          "+del.StartPoint.LineCharOffset);
        sb.AppendLine("Type: "+del.Type.TypeKind);
          MessageBox.Show(sb.ToString());
    }
    catch(System.Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

CodeDelegate2 인터페이스

DocComment 오버로드

EnvDTE80 네임스페이스

기타 리소스

방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행

코드 모델을 사용하여 코드 검색(Visual Basic)

코드 모델을 사용하여 코드 검색(Visual C#)