Freezable.Clone Freezable.Clone Freezable.Clone Freezable.Clone Method

定义

创建 Freezable 的可修改克隆,以制作该对象值的深层副本。Creates a modifiable clone of the Freezable, making deep copies of the object's values. 在复制此对象的依赖属性时,此方法会复制表达式(可能不再解析),但不复制动画或其当前值。When copying the object's dependency properties, this method copies expressions (which might no longer resolve) but not animations or their current values.

public:
 System::Windows::Freezable ^ Clone();
public System.Windows.Freezable Clone ();
member this.Clone : unit -> System.Windows.Freezable
Public Function Clone () As Freezable

返回

当前对象的可修改复本。A modifiable clone of the current object. 即使源的 IsFrozen 属性为 true.,所克隆对象的 IsFrozen 属性也为 falseThe cloned object's IsFrozen property is false even if the source's IsFrozen property is true.

注解

CloneCloneCurrentValue方法将产生的可修改克隆冻结Freezable对象 (方法还克隆Freezable未被冻结的对象)。The Clone and CloneCurrentValue methods produce modifiable clones of frozen Freezable objects (the methods also clone Freezable objects that are not frozen). 复本实际上是当前对象的深层副本。The clone is effectively a deep copy of the current object.

下表总结了之间的差异CloneCloneCurrentValue方法。The following table summarizes the differences between the Clone and CloneCurrentValue methods.

操作Action 克隆方法行为Clone method behavior CloneCurrentValue 方法行为CloneCurrentValue method behavior
复制包含的表达式的依赖项属性Copying a dependency property that has an expression 表达式复制,但可能不再解析。The expression is copied, but might no longer resolve. 有关详细信息,请参阅 Freezable 对象概述For more information, see Freezable Objects Overview. 复制当前表达式的值,但不是表达式本身。The current value of the expression is copied, but not the expression itself.
复制一个动画的依赖项属性Copying an animated dependency property 复制属性的基 (非动画的) 值。The property's base (non-animated) value is copied. 不复制动画。Animations are not copied. 复制属性的当前动画的值。The property's current animated value is copied. 不复制动画。Animations are not copied.

请注意,取消设置的属性将不会复制。Note that unset properties are not copied. 如果未设置的属性的默认值,则冻结Freezable,属性值保持在其他可修改复本冻结状态。If an unset property has a default value that is a frozen Freezable, that property value remains frozen in the otherwise modifiable clone.

Freezable 在线程间移动Move a Freezable Between Threads

此方法也可用于移动Freezable线程之间。This method can be useful for moving a Freezable between threads. 首先,请Freezable变为不可修改通过调用其Freeze方法。First, make the Freezable unmodifiable by calling its Freeze method. 现在,另一个线程可以访问Freezable并进行本地Clone,它可以访问。Now another thread can access the Freezable and make a local Clone that it can access.

继承者说明

此方法使用CloneCore(Freezable)生成复本。This method uses CloneCore(Freezable) to produce the clone. 若要修改此方法在派生类中的行为,请重写CloneCore(Freezable)方法。To modify the behavior of this method in a derived class, override the CloneCore(Freezable) method.

适用于

另请参阅