IRONSOFTWAREHOME
Set Max Parallel Threads
using IronBarCode;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

List<string> imagePaths = new List<string>() { "sample_a.png", "sample_b.png" };

// Barcode reading options
BarcodeReaderOptions options = new BarcodeReaderOptions()
{
    // Set Max threads to 4
    Multithreaded = true,
    MaxParallelThreads = 4,
};

// Read barcode with multithreaded enabled
BarcodeResults results = BarcodeReader.Read(imagePaths, options);

Imports IronBarCode
Imports System
Imports System.Collections.Generic
Imports System.Threading.Tasks

Dim imagePaths As New List(Of String)() From {"sample_a.png", "sample_b.png"}

' Barcode reading options
Dim options As New BarcodeReaderOptions() With {
    .Multithreaded = True,
    .MaxParallelThreads = 4
}

' Read barcode with multithreaded enabled
Dim results As BarcodeResults = BarcodeReader.Read(imagePaths, options)
NuGet Download
PM > Install-Package BarCode
Set Max Parallel Threads

Set Max Parallel Threads

Processing large batches of documents or images sequentially can be time-consuming, creating bottlenecks in high-volume applications. Using parallel threads allows the application to process multiple images simultaneously, significantly reducing overall execution time. In this code example, we will demonstrate how to configure IronBarcode to use multi-threading for faster batch barcode reading.

5-step guide for using parallel threads to read barcode

  • using IronBarCode;
  • using System.Threading.Tasks;
  • List<string> imagePaths = new List<string>() { "sample_a.png", "sample_b.png" };
  • BarcodeReaderOptions options = new BarcodeReaderOptions(){ Multithreaded = true, MaxParallelThreads = 4 };
  • BarcodeResults results = BarcodeReader.Read(imagePaths, options);

Code Explanation

First, the IronBarcode library and the threading namespace are imported, and a List<string> containing the file paths of the images to be processed is defined. In the example above, "sample_a.png" and "sample_b.png" are prepared for scanning.

Next, a BarcodeReaderOptions object is instantiated to configure the scanning behavior. Multithreaded Additionally, the ParallelProcessing property is set to true to enable parallel processing. Multithreaded The MaxDegreeOfParallelism property is also set to 4, instructing the reader to use up to 4 simultaneous threads while balancing performance with system resource usage. MaxParallelThreads MaxParallelThreads Read BarcodeReader.Read

Finally, ReadBarcodes is called, passing both the list of image paths and the configured options to retrieve the BarcodeResults.

Learn to set max parallel threads with IronBarcode

Ready to Get Started?

Nuget Downloads 2,422,100Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required