共用方式為


VCCodeIDLLibrary.IsReadOnly 屬性

取得值,這個值表示包含此物件的檔案是否為唯讀。

命名空間:  Microsoft.VisualStudio.VCCodeModel
組件:  Microsoft.VisualStudio.VCCodeModel (在 Microsoft.VisualStudio.VCCodeModel.dll 中)

語法

'宣告
ReadOnly Property IsReadOnly As Boolean
bool IsReadOnly { get; }
property bool IsReadOnly {
    bool get ();
}
abstract IsReadOnly : bool with get
function get IsReadOnly () : boolean

屬性值

型別:System.Boolean
如果包含此物件的檔案是唯讀的則為 true,否則為 false。

備註

如需這個範例的編譯與執行等詳細資訊,請參閱 HOW TO:編譯 Visual C++ 程式碼模型擴充性的範例程式碼

範例

本範例先確認檔案是否唯讀之前加上註解的程式碼項目。

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 安全性

請參閱

參考

VCCodeIDLLibrary 介面

Microsoft.VisualStudio.VCCodeModel 命名空間