Freezable.WritePreamble 方法


验证 Freezable 是否未被冻结,并且是否正在从有效的线程上下文中访问它。Verifies that the Freezable is not frozen and that it is being accessed from a valid threading context. Freezable 的继承项应当在任何 API 一开始写入不属于依赖项属性的数据成员时调用此方法。Freezable inheritors should call this method at the beginning of any API that writes to data members that are not dependency properties.

 void WritePreamble();
protected void WritePreamble ();
member this.WritePreamble : unit -> unit
Protected Sub WritePreamble ()


Freezable 实例已冻结,并且无法写入其成员。The Freezable instance is frozen and cannot have its members written to.


此方法调用 VerifyAccess 来验证线程上下文是否可访问,如果实例已冻结,则会引发异常 FreezableThis method calls VerifyAccess to verify the threading context is accessible, and it throws an exception if the Freezable instance is already frozen.


派生自的类 FreezableWritePreamble() 在尝试写入非依赖项属性的任何成员之前调用。Classes that derive from Freezable should call WritePreamble() before attempting to write to any members that are not dependency properties. 如果 WritePreamble() 在 API 中调用,则可忽略对的调用 ReadPreamble()If you call WritePreamble() in an API, you can omit a call to ReadPreamble().