IDictionary.IsReadOnly 属性

定义

获取一个值,该值指示 IDictionary 对象是否为只读。Gets a value indicating whether the IDictionary object is read-only.

public:
 property bool IsReadOnly { bool get(); };
public bool IsReadOnly { get; }
member this.IsReadOnly : bool
Public ReadOnly Property IsReadOnly As Boolean

属性值

Boolean

如果 IDictionary 对象为只读,则为 true;否则为 falsetrue if the IDictionary object is read-only; otherwise, false.

示例

下面的代码示例演示如何实现 IsReadOnly 属性。The following code example demonstrates how to implement the IsReadOnly property. 此代码示例是为类提供的更大示例的一部分 IDictionaryThis code example is part of a larger example provided for the IDictionary class.

public:
    property virtual bool IsReadOnly
    {
        bool get()
        {
            return false;
        }
    }
public bool IsReadOnly { get { return false; } }
Public ReadOnly Property IsReadOnly() As Boolean Implements IDictionary.IsReadOnly
    Get
        Return False
    End Get
End Property

注解

在创建只读集合后,该集合不允许添加、移除或修改元素。A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created.

适用于