VCCodeProperty.IsReadOnly 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个值,该值指示包含对象的文件是否为只读文件。
public:
property bool IsReadOnly { bool get(); };
public:
property bool IsReadOnly { bool get(); };
[System.Runtime.InteropServices.DispId(514)]
public bool IsReadOnly { [System.Runtime.InteropServices.DispId(514)] [System.Runtime.InteropServices.TypeLibFunc(System.Runtime.InteropServices.TypeLibFuncFlags.FNonBrowsable)] get; }
[<System.Runtime.InteropServices.DispId(514)>]
[<get: System.Runtime.InteropServices.DispId(514)>]
[<get: System.Runtime.InteropServices.TypeLibFunc(System.Runtime.InteropServices.TypeLibFuncFlags.FNonBrowsable)>]
member this.IsReadOnly : bool
Public ReadOnly Property IsReadOnly As Boolean
属性值
true 如果包含对象的文件是只读的,则为; 否则为。否则为 false 。
- 属性
示例
此示例在向代码元素添加注释之前验证该文件是否为只读。
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
注解
有关如何编译和运行此示例的信息,请参阅 如何:编译 Visual C++ 代码模型扩展性的示例代码 。