IDictionary.IsFixedSize 属性

定义

获取一个值,该值指示 IDictionary 对象是否具有固定大小。Gets a value indicating whether the IDictionary object has a fixed size.

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

属性值

如果 true 对象具有固定大小,则为 IDictionary;否则为 falsetrue if the IDictionary object has a fixed size; otherwise, false.

示例

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

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

注解

具有固定大小的集合不允许在创建集合后添加或删除元素,但允许修改现有元素。A collection with a fixed size does not allow the addition or removal of elements after the collection is created, but does allow the modification of existing elements.

具有固定大小的集合就是一个集合,其中包含阻止添加和移除元素的包装;因此,如果对基础集合进行了更改,包括添加或删除元素,则固定大小的集合将反映这些更改。A collection with a fixed size is simply a collection with a wrapper that prevents adding and removing elements; therefore, if changes are made to the underlying collection, including the addition or removal of elements, the fixed-size collection reflects those changes.

适用于