Freezable.IsFrozen プロパティ
定義
オブジェクトが変更可能かどうかを示す値を取得します。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
。オブジェクトを変更できる場合は、false
。true
if the object is frozen and cannot be modified; false
if the object can be modified.
注釈
プロパティがをスローしたときにオブジェクトを変更しようとしてい IsFrozen true
InvalidOperationException ます。Attempting 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. このプロパティの値を設定するには、を呼び出す必要があり Freeze ます。To set the value of this property, you should call Freeze. これは実質的には、 IsFrozen プロパティを初期の既定の false
状態から状態に変更する1回限りの操作です true
。This effectively is a one-time operation to change the IsFrozen property from the initial default false
state to the true
state. 値をに戻すことができる方法はありません false
。There 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.