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.

備註

當物件的true屬性擲回時IsFrozen , 嘗試修改它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行為IsFrozen true時, 某些行為的相關檔可能會提及「設定為」或類似語言, 但此行為會在類別實例內部發生。 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.

適用於