VCCodeInterface::IsReadOnly Property
Visual Studio 2015
Gets a value indicating whether the file containing the object is read-only.
Assembly: Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)
Property Value
Type: System::Booleantrue if the file containing the object is read-only; otherwise, false.
See How to: Compile Example Code for Visual C++ Code Model Extensibility 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.
[Visual Basic]
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
Show: