Creates an exact copy of this
AnnObject object.
Supported in Silverlight, Windows Phone 7
Syntax
Visual Basic (Declaration) | |
---|
Public Overridable Function Clone() As AnnObject |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As AnnObject
Dim value As AnnObject
value = instance.Clone() |
Return Value
The
AnnObject object that this class creates.
Example
This example copies the objects from one container to another.
Visual Basic | Copy Code |
---|
Public Sub AnnObject_Clone(ByVal srcContainer As AnnContainer, ByVal destContainer As AnnContainer)
' first remove all objects from the destination container
destContainer.Children.Clear()
' copy the objects from the src to the destination container
For Each srcObj As AnnObject In srcContainer.Children
' we want to keep the original object intact, so create an exact copy by cloning the object
Dim destObj As AnnObject = DirectCast(srcObj.Clone(), AnnObject)
destContainer.Children.Add(destObj)
Next srcObj
End Sub |
C# | Copy Code |
---|
public void AnnObject_Clone(AnnContainer srcContainer, AnnContainer destContainer)
{
// first remove all objects from the destination container
destContainer.Children.Clear();
// copy the objects from the src to the destination container
foreach (AnnObject srcObj in srcContainer.Children)
{
// we want to keep the original object intact, so create an exact copy by cloning the object
AnnObject destObj = srcObj.Clone() as AnnObject;
destContainer.Children.Add(destObj);
}
} |
SilverlightCSharp | Copy Code |
---|
public void AnnObject_Clone(AnnContainer srcContainer, AnnContainer destContainer)
{
// first remove all objects from the destination container
destContainer.Children.Clear();
// copy the objects from the src to the destination container
foreach (AnnObject srcObj in srcContainer.Children)
{
// we want to keep the original object intact, so create an exact copy by cloning the object
AnnObject destObj = srcObj.Clone() as AnnObject;
destContainer.Children.Add(destObj);
}
} |
SilverlightVB | Copy Code |
---|
Public Sub AnnObject_Clone(ByVal srcContainer As AnnContainer, ByVal destContainer As AnnContainer)
' first remove all objects from the destination container
destContainer.Children.Clear()
' copy the objects from the src to the destination container
For Each srcObj As AnnObject In srcContainer.Children
' we want to keep the original object intact, so create an exact copy by cloning the object
Dim destObj As AnnObject = TryCast(srcObj.Clone(), AnnObject)
destContainer.Children.Add(destObj)
Next srcObj
End Sub |
Requirements
Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)
See Also