Freezable.IsFrozen Freezable.IsFrozen Freezable.IsFrozen Freezable.IsFrozen Property

定义

获取一个值,该值指示对象当前是否可修改。Gets a value that indicates whether the object is currently modifiable.

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

属性值

如果该对象已被冻结且无法修改,则为 true;如果可以修改该对象,则为 falsetrue if the object is frozen and cannot be modified; false if the object can be modified.

注解

尝试修改对象时其IsFrozen属性是true引发InvalidOperationExceptionAttempting to modify an object when its IsFrozen property is true throws an InvalidOperationException.

此属性是只读的对象模型透视。This property is read-only from the object model perspective. 有关文档的一些Freezable行为可能涉及"设置IsFrozentrue"或类似语言时讨论的其他方法的行为Freezable,但此行为中发生的情况在内部类的实例,当实例方法操作的抽象类中存在的私有变量。Some of the documentation about Freezable behaviors may mention "sets IsFrozen to true" or similar language when discussing the behavior of other methods of Freezable, but this behavior is happening internally in the class instances, when methods of the instance manipulate the private variables that exist within the abstract class. 若要设置此属性的值,应调用FreezeTo set the value of this property, you should call Freeze. 这实际上是一次性的操作来更改IsFrozen属性从默认的初始false状态转换true状态。This effectively is a one-time operation to change the IsFrozen property from the initial default false state to the true state. 没有可用的方法将值返回到falseThere is no available means to set the value back to false. 相反,可以将更改从原始制作的深层副本 (请参阅Clone方法)。Instead, you could change any deep copy made from the original (see the Clone method). 这是设计使然,任何派生的类的行为方式时应用于事例其中Freezable模式非常有用。This is by design and is how any derived class should behave when applied to the cases where the Freezable pattern is useful.

适用于