讀取 QR 碼型別
using IronQr;
using System.Drawing;
using System.Linq;

// Import an image containing a QR code
var inputImage = Image.FromFile("sample.jpg");

// Load the asset into a QrImageInput object
var imageInput = new QrImageInput(inputImage);

// Create a QR Reader object
var reader = new QrReader();

// Read the input and get all embedded QR codes
IEnumerable<QrResult> results = reader.Read(imageInput);

// Display the type of the first QR code found
Console.WriteLine($"The QR type is {results.First().QrType}");
NuGet 下載
PM > Install-Package IronQR
讀取 QR 碼型別

讀取 QR 碼型別

當需處理多種不同格式的 QR 碼作為輸入時,可透過 IronQR 輕鬆驗證 QR 碼格式,以進行智慧型處理。 IronQR通過QrResult.QrType來展示檢測到的符號學,使應用程序可以根據格式驗證、路由或記錄掃描的代碼。

掃描 QR 碼的 5 步驟指南

  • using IronQr;
  • QrImageInput imageInput = new QrImageInput(Image.FromFile("sample.jpg"));
  • QrReader reader = new QrReader();
  • IEnumerable<QrResult> results = reader.Read(imageInput);
  • Console.WriteLine($"The QR type is {results.First().QrType}");

程式碼說明

載入包含QR碼的圖像從磁碟並包裝在QrImageInput對象中。 一個QrReader實例掃描輸入並返回QrResult物件的集合,每個偵測到的QR Code對應一個物件。 在結果上訪問QrType會返回一個QrEncoding枚舉值,用於識別偵測到的符號學,如QRCode或MicroQRCode。

探索如何使用 IronQR 讀取各種 QR 碼類型。

準備好開始了嗎?

NuGet 下載次數 83,364版本:2026.11剛剛發布