다음을 통해 공유


CodeClass2.DataTypeKind 속성

다른 클래스와 이 클래스의 관계를 설정하거나 가져옵니다.

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

구문

‘선언
Property DataTypeKind As vsCMDataTypeKind
vsCMDataTypeKind DataTypeKind { get; set; }
property vsCMDataTypeKind DataTypeKind {
    vsCMDataTypeKind get ();
    void set (vsCMDataTypeKind value);
}
abstract DataTypeKind : vsCMDataTypeKind with get, set
function get DataTypeKind () : vsCMDataTypeKind 
function set DataTypeKind (value : vsCMDataTypeKind)

속성 값

형식: EnvDTE80.vsCMDataTypeKind
vsCMDataTypeKind 열거형의 값을 반환합니다.

설명

예를 들어, partial의 주 클래스이면 이 호출에서 vsCMDataTypeKindMain을 반환합니다. partial 클래스이면 vsCMDataTypeKindPartial을 반환합니다.

참고

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

예제

[Visual Basic]

Sub DataTypeKindExample(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 cls As CodeClass2 = _
          CType(sel.ActivePoint.CodeElement( _
        vsCMElement.vsCMElementClass), CodeClass2)

        ' Displays the data type kind of the class.
        Select Case cls.DataTypeKind
            Case vsCMDataTypeKind.vsCMDataTypeKindBlueprint
                MsgBox("Class data type: Blueprint")
            Case vsCMDataTypeKind.vsCMDataTypeKindMain
                MsgBox("Class data type: Main")
            Case vsCMDataTypeKind.vsCMDataTypeKindModule
                MsgBox("Class data type: Module")
            Case vsCMDataTypeKind.vsCMDataTypeKindPartial
                MsgBox("Class data type: Partial")
        End Select

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

[C#]

public void DataTypeKindExample(DTE2 dte)
{
    // 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.
        TextSelection sel = 
        (TextSelection)dte.ActiveDocument.Selection;
        CodeClass2 cls = 
        (CodeClass2)sel.ActivePoint.get_CodeElement
        (vsCMElement.vsCMElementClass);

        // Display the data type kind of the class.
        MessageBox.Show("Class data type kind: " + cls.DataTypeKind);
    }
    catch (System.Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework 보안

참고 항목

참조

CodeClass2 인터페이스

EnvDTE80 네임스페이스

기타 리소스

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

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

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