Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets if the file containing the object is read-only.
Namespace: Microsoft.VisualStudio.VCCodeModel
Assembly: Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)
Syntax
'Declaration
ReadOnly Property IsReadOnly As Boolean
Get
bool IsReadOnly { get; }
property bool IsReadOnly {
bool get ();
}
abstract IsReadOnly : bool
function get IsReadOnly () : boolean
Property Value
Type: System.Boolean
true if the file containing the 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.
[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
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.