Freezable.Clone Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Returns
A modifiable clone of the current object. The cloned object's IsFrozen property is false
even if the source's IsFrozen property is true
.
Remarks
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.
The following table summarizes the differences between the Clone and CloneCurrentValue methods.
Action | Clone method behavior | CloneCurrentValue method behavior |
---|---|---|
Copying a dependency property that has an expression | The expression is copied, but might no longer resolve. 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. If an unset property has a default value that is a frozen Freezable, that property value remains frozen in the otherwise modifiable clone.
Move a Freezable Between Threads
This method can be useful for moving a Freezable between threads. First, make the Freezable unmodifiable by calling its Freeze method. Now another thread can access the Freezable and make a local Clone that it can access.
Notes to Inheritors
This method uses CloneCore(Freezable) to produce the clone. To modify the behavior of this method in a derived class, override the CloneCore(Freezable) method.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기