←Select platform

IndexDuplicate Property


Gets a zero-based index of the next duplicated barcode.


public int IndexDuplicate {get;} 
Public ReadOnly Property IndexDuplicate As Integer 
property int IndexDuplicate { 
   int get(); 

Property Value

Possible values are:

=0, Next duplicated index.

-1, The barcode is not duplicated.

0xFF, The barcode is the last duplicated one.


The Read method updates the value of this property.

LEADTOOLS provides a number of functions to let you work with duplicated barcodes. They let you:

  • Find the number of duplicates of a specific barcode
  • Determine whether a specific barcode is duplicated
  • Get the index of the first duplicated barcode
  • Get the index of a subsequent barcode

To determine whether a barcode is duplicated, use the IsDuplicated property. If a barcode is duplicated, the DuplicatedIndex property will return the index of the first barcode in the array after the specified barcode, which is a duplicate of the specified barcode. The DuplicateCount property will get the total number of barcodes duplicated for the current barcode.

If you know the index of a barcode within an array, use the IndexDuplicate property to get the next instance of a duplicated barcode. Call the GetFirstDuplicatedIndex method to find the index of the first barcode in the array that is a duplicate of the barcode at the specified index. Call the GetNextDuplicated method to find the index of the next barcode in the array that is a duplicate of the barcode at the specified index.

To find out how many sets of barcodes are duplicated (for example, in an array of ten barcodes, the first, third, and fifth might be duplicates of each other, while the 4th, 8th and 9th are duplicates of a different barcode), use the following code:

Visual Basic
Private Function GetSetsCount(ByRef barcodeData As RasterCollection(Of BarcodeData)) As Integer  
   Dim i As Integer  
   Dim j As Integer  
   Dim count As Integer  
   Dim visited() As Boolean  
   ReDim visited(barcodeData.Count) count = 0  
   For i = 0 To barcodeData.Count - 1  
      If visited(i) Then  
         Continue For  
      End If  
      visited(i) = True  
      count += 1  
      j = i  
      While barcodeData(j).IndexDuplicate <> -1 And barcodeData(j).IndexDuplicate <> 255  
         j = barcodeData(j).IndexDuplicate  
         visited(j) = True  
      End While  
   Return count  
End Function 

public int GetSetsCount(RasterCollection<BarcodeData> barcodeData) 
   int i, j, count;  
   bool [] visited = new bool [barcodeData.Count];  
   count = 0;  
   for (i = 0; i < barcodeData.Count; i++)  
      if (visited[i])  
      visited[i] = true;  
      j = i;  
      while (barcodeData[j].IndexDuplicate != -1 && barcodeData[j].IndexDuplicate != 255) 
         j = barcodeData[j].IndexDuplicate; visited[j] = true; 
   return count; 

After this code is executed, count will contain the number of different sets of barcodes.


Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Barcode Assembly