Used to duplicate objects either by the ISerializable interface or by field-level duplication.
Syntax
Visual Basic (Declaration) | |
---|
Public Function New() |
C# | |
---|
public SerializerClone() |
Example
Library/Library.Test/TestWeakReferenceT.cs
C# | Copy Code |
---|
string value = "Testing Value";
Utils.WeakReference<string> r;
r = new Utils.WeakReference<string>(value);
Utils.WeakReference<string> r2 = new Cloning.SerializerClone().Clone(r);
Assert.AreEqual(r.Target, r2.Target);
Assert.AreEqual(value, r2.Target);
string tmp;
Assert.IsTrue(r2.TryGetTarget(out tmp) && tmp == value); |
VB.NET | Copy Code |
---|
Dim value As String = "Testing Value"
Dim r As Utils.WeakReference(Of String)
r = New Utils.WeakReference(Of String)(value)
Dim r2 As Utils.WeakReference(Of String) = New Cloning.SerializerClone().Clone(r)
Assert.AreEqual(r.Target, r2.Target)
Assert.AreEqual(value, r2.Target)
Dim tmp As String
Assert.IsTrue(r2.TryGetTarget(tmp) AndAlso tmp = value) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also