Freezable.WritePreamble Freezable.WritePreamble Freezable.WritePreamble Freezable.WritePreamble Method

定义

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

protected:
 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来验证线程上下文是否可访问, Freezable如果实例已冻结, 则会引发异常。This method calls VerifyAccess to verify the threading context is accessible, and it throws an exception if the Freezable instance is already frozen.

继承者说明

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

适用于

另请参阅