This documentation is archived and is not being maintained.

VCCodeDelegate.IsReadOnly Property 

Gets a value indicating whether the file containing the VCCodeDelegate object is read-only.

Namespace: Microsoft.VisualStudio.VCCodeModel
Assembly: Microsoft.VisualStudio.VCCodeModel (in microsoft.visualstudio.vccodemodel.dll)

bool IsReadOnly { get; }
/** @property */
boolean get_IsReadOnly ()

function get IsReadOnly () : boolean

Property Value

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

See Visual C++ Code Model Samples for information on how to compile and run this sample.

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