Creates an exact copy of this barcode.
public virtual BarcodeData Clone()
Public Overridable Function Clone() As BarcodeData
- (instancetype)copy
public BarcodeData clone()
public:
virtual BarcodeData^ Clone();
The BarcodeData method creates, and casts the barcode as an object.
This methods clones (creates a new object) of the byte array that represents that data obtained from GetData. This data will not be shared between this BarcodeData and the object that is returned.
However, Tag is user defined value and BarcodeData does not have rules to dictate what action to perform when the object is cloned. Therefore, this method will simply set the Tag property of the returned object to the value in the source object. It is up to the user to change this behavior.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Barcode;
using Leadtools.ImageProcessing;
public void BarcodeData_CloneExample()
{
// Create a BarcodeData object
BarcodeData data1 = new BarcodeData(BarcodeSymbology.UPCA, "01234567890");
data1.Bounds = new LeadRect(0, 0, 400, 200);
// Clone it
BarcodeData data2 = data1.Clone() as BarcodeData;
// Make sure they have the same value but not same reference
Debug.Assert(data1 != data2);
Debug.Assert(data1.Symbology == data2.Symbology);
Debug.Assert(data1.Value == data2.Value);
Debug.Assert(data1.Bounds == data2.Bounds);
Console.WriteLine("Cloned OK");
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Barcode
Imports Leadtools.ImageProcessing
Public Sub BarcodeData_CloneExample()
' Create a BarcodeData object
Dim data1 As New BarcodeData(BarcodeSymbology.UPCA, "01234567890")
data1.Bounds = New LeadRect(0, 0, 400, 200)
' Clone it
Dim data2 As BarcodeData = DirectCast(data1.Clone(), BarcodeData)
' Make sure they have the same value but not same reference
Debug.Assert(Not data1 Is data2)
Debug.Assert(data1.Symbology = data2.Symbology)
Debug.Assert(data1.Value = data2.Value)
Debug.Assert(data1.Bounds = data2.Bounds)
Console.WriteLine("Cloned OK")
End Sub
c#[Silverlight C# Example]
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms;
using Leadtools.Barcode;
using Leadtools.ImageProcessing;
using Leadtools.Examples;
public void BarcodeData_CloneExample()
{
// Create a BarcodeData object
BarcodeData data1 = new BarcodeData(BarcodeSymbology.UPCA, "01234567890");
data1.Bounds = new LogicalRectangle(0, 0, 400, 200, LogicalUnit.Pixel);
// Clone it
BarcodeData data2 = data1.Clone() as BarcodeData;
// Make sure they have the same value but not same reference
Debug.Assert(data1 != data2);
Debug.Assert(data1.Symbology == data2.Symbology);
Debug.Assert(data1.Value == data2.Value);
Debug.Assert(data1.Bounds == data2.Bounds);
Console.WriteLine("Cloned OK");
}
vb[Silverlight VB Example]
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Forms
Imports Leadtools.Barcode
Imports Leadtools.ImageProcessing
Public Sub BarcodeData_CloneExample()
' Create a BarcodeData object
Dim data1 As BarcodeData = New BarcodeData(BarcodeSymbology.UPCA, "01234567890")
data1.Bounds = New LogicalRectangle(0, 0, 400, 200, LogicalUnit.Pixel)
' Clone it
Dim data2 As BarcodeData = TryCast(data1.Clone(), BarcodeData)
' Make sure they have the same value but not same reference
Debug.Assert(Not data1 Is data2)
Debug.Assert(data1.Symbology = data2.Symbology)
Debug.Assert(data1.Value = data2.Value)
Debug.Assert(data1.Bounds = data2.Bounds)
Console.WriteLine("Cloned OK")
End Sub
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document