VCCodeElement.IsReadOnly Property

Gets a value indicating if the file containing the VCCodeElement object is read-only.

Namespace:  Microsoft.VisualStudio.VCCodeModel
Assembly:  Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)

Syntax

声明
ReadOnly Property IsReadOnly As Boolean
用法
Dim instance As VCCodeElement
Dim value As Boolean

value = instance.IsReadOnly
bool IsReadOnly { get; }
property bool IsReadOnly {
    bool get ();
}
function get IsReadOnly () : boolean

Property Value

Type: System.Boolean

true if the file containing the VCCodeElement object is read-only; otherwise, false.

Remarks

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

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

Permissions

See Also

Reference

VCCodeElement Interface

VCCodeElement Members

Microsoft.VisualStudio.VCCodeModel Namespace