다음을 통해 공유


VCCodeAttribute.IsReadOnly 속성

부모 개체가 들어 있는 파일이 읽기 전용인지 여부를 나타내는 값을 가져옵니다.

네임스페이스:  Microsoft.VisualStudio.VCCodeModel
어셈블리:  Microsoft.VisualStudio.VCCodeModel(Microsoft.VisualStudio.VCCodeModel.dll)

구문

‘선언
ReadOnly Property IsReadOnly As Boolean
bool IsReadOnly { get; }
property bool IsReadOnly {
    bool get ();
}
abstract IsReadOnly : bool with get
function get IsReadOnly () : boolean

속성 값

형식: Boolean
부모 개체가 들어 있는 파일이 읽기 전용이면 true이고, 그렇지 않으면 false입니다.

설명

이 샘플을 컴파일하고 실행하는 방법을 보려면 방법: Visual C++ 코드 모델 확장성에 대한 예제 코드 컴파일을 참조하십시오.

예제

코드 요소에 주석을 추가 하기 전에 해당 파일은 읽기 전용 경우 확인 하는이 예제입니다.

' Macro code.
Sub AddComment()
    Dim vcElement As VCCodeElement
    Dim vcElements As VCCodeElements
    Dim textPoint As TextPoint
    vcElements = DTE.Solution.Item(1).CodeModel.Classes
    vcElement = vcElements.Item(1)
    If (Not vcElement.IsReadOnly) Then
        vcElement.Comment = "This is a comment."
    End If
End Sub

.NET Framework 보안

참고 항목

참조

VCCodeAttribute 인터페이스

Microsoft.VisualStudio.VCCodeModel 네임스페이스