다음을 통해 공유


VCCodeUnion.IsReadOnly Property

Definition

Gets whether the file containing the object is read-only.

public:
 property bool IsReadOnly { bool get(); };
public:
 property bool IsReadOnly { bool get(); };
[System.Runtime.InteropServices.DispId(514)]
public bool IsReadOnly { [System.Runtime.InteropServices.DispId(514)] [System.Runtime.InteropServices.TypeLibFunc(System.Runtime.InteropServices.TypeLibFuncFlags.FNonBrowsable)] get; }
[<System.Runtime.InteropServices.DispId(514)>]
[<get: System.Runtime.InteropServices.DispId(514)>]
[<get: System.Runtime.InteropServices.TypeLibFunc(System.Runtime.InteropServices.TypeLibFuncFlags.FNonBrowsable)>]
member this.IsReadOnly : bool
Public ReadOnly Property IsReadOnly As Boolean

Property Value

true if the current element is read-only; otherwise, false.

Attributes

Examples

This example verifies if the file is read-only before adding a comment to the code element.

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  

Remarks

See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.

Applies to