C#에서 바코드 작업을 위한 널 체크 처리 방법
IronBarcode는 C#에서 BarcodeReader.Read를 통해 스캔 결과를 BarcodeResults 컬렉션으로 반환합니다. 이 메서드는 입력 이미지를 인식할 수 없는 경우 null을 반환하고, 바코드가 감지되지 않은 경우 빈 컬렉션을 반환합니다. BarcodeWriter.CreateBarcode는 입력이 null이거나 비어 있거나 잘못된 형식일 경우 예외를 발생시킵니다.
카메라 영상, 문서 업로드, 창고 스캐너와 같은 실제 스캔 소스는 항상 판독 가능한 바코드를 제공하지 않을 수 있습니다. 결과 속성에 접근하거나 컬렉션을 반복하기 전에 null 또는 빈 값을 확인하지 않으면 런타임에 NullReferenceException가 발생할 수 있습니다. 잘못된 문자열을 쓰기 API에 전달하면 ArgumentException가 발생할 수 있습니다. 읽기 및 쓰기 작업 모두에서 가드 절을 사용하면 실제 운영 환경에서 이러한 예외를 방지하는 데 도움이 됩니다.
이 방법은 IronBarcode 읽기 및 쓰기 작업에서 null과 빈 결과를 처리하는 방법을 가드 절, 신뢰도 필터링 및 재사용 가능한 유효성 검사자 패턴을 사용하여 설명합니다.
빠른 시작: 바코드 작업에서 널 결과 처리
Any 결과 속성에 접근하기 전에 BarcodeResults 컬렉션을 안전하게 확인하려면 IronBarcode의 가드 패턴을 사용하세요. 지금 바로 이 간단한 읽기 및 확인 절차를 시작해 보세요.
-
1IronBarcode를 NuGet Package Manager로 설치하십시오
-
2다음 코드 조각을 복사하여 실행하세요.
using IronBarCode; using System; using System.Linq; BarcodeResults results = BarcodeReader.Read("label.png"); // Guard: null or empty if (results is null || results.Count == 0) { Console.WriteLine("No barcodes detected."); return; } Console.WriteLine(results.First().Value);Imports IronBarCode Imports System Imports System.Linq Dim results As BarcodeResults = BarcodeReader.Read("label.png") ' Guard: null or empty If results Is Nothing OrElse results.Count = 0 Then Console.WriteLine("No barcodes detected.") Return End If Console.WriteLine(results.First().Value)Imports IronBarCode Imports System Imports System.Linq Dim results As BarcodeResults = BarcodeReader.Read("label.png") ' Guard: null or empty If results Is Nothing OrElse results.Count = 0 Then Console.WriteLine("No barcodes detected.") Return End If Console.WriteLine(results.First().Value) -
3실제 운영 환경에서 테스트할 수 있도록 배포하세요.
오늘 프로젝트에서 IronBarcode 사용을 시작해보세요 무료 체험
IronBarcode 사용한 바코드 작업에서 null 값 검사를 처리하는 방법
- NuGet에서 IronBarcode 라이브러리 다운로드
BarcodeReader.Read호출하고BarcodeResults반환 값을 캡처합니다.- 결과에 접근하기 전에 null인지 확인하십시오.
- 후속 사용 전에
BarcodeResult개별 속성을 검증하십시오. - 스캔 단계에서 품질이 낮은 판독값을 필터링하려면
BarcodeReaderOptions에서ConfidenceThreshold설정하십시오.
널 및 빈 바코드 결과를 처리하는 방법?
두 가지 실패 모드가 있습니다: 입력이 유효한 이미지가 아닐 경우 BarcodeResults가 null이며, 이미지에 바코드가 포함되어 있지 않으면 비어 있습니다. First, Value를 접근하거나 두 가지 조건을 확인하지 않고 반복하면 런타임 예외가 발생합니다.
처리 루프에 들어가기 전에 두 가지 조건을 모두 확인하십시오.
입력
Code128 바코드 배송 라벨(성공 경로)과 바코드가 없는 빈 이미지(실패 경로).

shipping-label.png (성공 경로)

blank-image.png (오류 경로, 바코드 없음)
using IronBarCode;
// BarcodeReader.Read() returns a BarcodeResults collection, not a single result
BarcodeResults results = BarcodeReader.Read("shipping-label.png");
// Null check: image was not recognized as a valid image source
// Empty check: image was valid but contained no detectable barcodes
if (results is null || results.Count == 0)
{
// Log, return a default, or throw a domain-specific exception
Console.WriteLine("No barcodes found in the input image.");
return;
}
// Collection is safe to iterate; each BarcodeResult holds one decoded barcode
foreach (BarcodeResult result in results)
{
// Guard individual result properties; partial scans or severely
// damaged barcodes can produce results where .Value is empty or whitespace
if (string.IsNullOrWhiteSpace(result.Value))
{
Console.WriteLine($"Empty value detected for {result.BarcodeType}");
continue;
}
// BarcodeType identifies the symbology (Code128, QRCode, EAN8, etc.)
Console.WriteLine($"Type: {result.BarcodeType}, Value: {result.Value}");
}using IronBarCode;
// BarcodeReader.Read() returns a BarcodeResults collection, not a single result
BarcodeResults results = BarcodeReader.Read("shipping-label.png");
// Null check: image was not recognized as a valid image source
// Empty check: image was valid but contained no detectable barcodes
if (results is null || results.Count == 0)
{
// Log, return a default, or throw a domain-specific exception
Console.WriteLine("No barcodes found in the input image.");
return;
}
// Collection is safe to iterate; each BarcodeResult holds one decoded barcode
foreach (BarcodeResult result in results)
{
// Guard individual result properties; partial scans or severely
// damaged barcodes can produce results where .Value is empty or whitespace
if (string.IsNullOrWhiteSpace(result.Value))
{
Console.WriteLine($"Empty value detected for {result.BarcodeType}");
continue;
}
// BarcodeType identifies the symbology (Code128, QRCode, EAN8, etc.)
Console.WriteLine($"Type: {result.BarcodeType}, Value: {result.Value}");
}Imports IronBarCode
' BarcodeReader.Read() returns a BarcodeResults collection, not a single result
Dim results As BarcodeResults = BarcodeReader.Read("shipping-label.png")
' Null check: image was not recognized as a valid image source
' Empty check: image was valid but contained no detectable barcodes
If results Is Nothing OrElse results.Count = 0 Then
' Log, return a default, or throw a domain-specific exception
Console.WriteLine("No barcodes found in the input image.")
Return
End If
' Collection is safe to iterate; each BarcodeResult holds one decoded barcode
For Each result As BarcodeResult In results
' Guard individual result properties; partial scans or severely
' damaged barcodes can produce results where .Value is empty or whitespace
If String.IsNullOrWhiteSpace(result.Value) Then
Console.WriteLine($"Empty value detected for {result.BarcodeType}")
Continue For
End If
' BarcodeType identifies the symbology (Code128, QRCode, EAN8, etc.)
Console.WriteLine($"Type: {result.BarcodeType}, Value: {result.Value}")
NextImports IronBarCode
' BarcodeReader.Read() returns a BarcodeResults collection, not a single result
Dim results As BarcodeResults = BarcodeReader.Read("shipping-label.png")
' Null check: image was not recognized as a valid image source
' Empty check: image was valid but contained no detectable barcodes
If results Is Nothing OrElse results.Count = 0 Then
' Log, return a default, or throw a domain-specific exception
Console.WriteLine("No barcodes found in the input image.")
Return
End If
' Collection is safe to iterate; each BarcodeResult holds one decoded barcode
For Each result As BarcodeResult In results
' Guard individual result properties; partial scans or severely
' damaged barcodes can produce results where .Value is empty or whitespace
If String.IsNullOrWhiteSpace(result.Value) Then
Console.WriteLine($"Empty value detected for {result.BarcodeType}")
Continue For
End If
' BarcodeType identifies the symbology (Code128, QRCode, EAN8, etc.)
Console.WriteLine($"Type: {result.BarcodeType}, Value: {result.Value}")
Next각 BarcodeResult는 Value 및 Text 문자열 속성을 제공합니다. 둘 다 디코드된 바코드 콘텐츠를 반환합니다. 바코드가 심하게 손상되었거나 스캔이 부분적으로만 이루어진 경우, 값이 비어 있거나 공백으로 표시될 수 있습니다. 빈 값이 다운스트림 시스템에 도달하지 않도록 각 결과에 대해 string.IsNullOrWhiteSpace를 사용하세요.
BarcodeReaderOptions에는 또한 ConfidenceThreshold 속성이 있습니다(0.0에서 1.0까지), 이는 낮은 품질의 읽기 작업을 결과 컬렉션에 도달하기 전에 제거합니다:
using IronBarCode;
// ConfidenceThreshold filters low-quality reads before they enter the
// BarcodeResults collection. Reads below the threshold are discarded
// during scanning, not after, so no post-filtering of the collection is needed.
var options = new BarcodeReaderOptions
{
ConfidenceThreshold = 0.7 // range 0.0 to 1.0; lower values accept weaker signals
};
BarcodeResults results = BarcodeReader.Read("shipping-label.png", options);
// Still check for null and empty even with a threshold applied;
// an image with no barcodes returns an empty collection, not null
if (results is null || results.Count == 0)
{
Console.WriteLine("No barcodes met the confidence threshold.");
return;
}
foreach (var result in results)
Console.WriteLine($"Type: {result.BarcodeType}, Value: {result.Value}");using IronBarCode;
// ConfidenceThreshold filters low-quality reads before they enter the
// BarcodeResults collection. Reads below the threshold are discarded
// during scanning, not after, so no post-filtering of the collection is needed.
var options = new BarcodeReaderOptions
{
ConfidenceThreshold = 0.7 // range 0.0 to 1.0; lower values accept weaker signals
};
BarcodeResults results = BarcodeReader.Read("shipping-label.png", options);
// Still check for null and empty even with a threshold applied;
// an image with no barcodes returns an empty collection, not null
if (results is null || results.Count == 0)
{
Console.WriteLine("No barcodes met the confidence threshold.");
return;
}
foreach (var result in results)
Console.WriteLine($"Type: {result.BarcodeType}, Value: {result.Value}");Imports IronBarCode
' ConfidenceThreshold filters low-quality reads before they enter the
' BarcodeResults collection. Reads below the threshold are discarded
' during scanning, not after, so no post-filtering of the collection is needed.
Dim options As New BarcodeReaderOptions With {
.ConfidenceThreshold = 0.7 ' range 0.0 to 1.0; lower values accept weaker signals
}
Dim results As BarcodeResults = BarcodeReader.Read("shipping-label.png", options)
' Still check for null and empty even with a threshold applied;
' an image with no barcodes returns an empty collection, not null
If results Is Nothing OrElse results.Count = 0 Then
Console.WriteLine("No barcodes met the confidence threshold.")
Return
End If
For Each result In results
Console.WriteLine($"Type: {result.BarcodeType}, Value: {result.Value}")
NextImports IronBarCode
' ConfidenceThreshold filters low-quality reads before they enter the
' BarcodeResults collection. Reads below the threshold are discarded
' during scanning, not after, so no post-filtering of the collection is needed.
Dim options As New BarcodeReaderOptions With {
.ConfidenceThreshold = 0.7 ' range 0.0 to 1.0; lower values accept weaker signals
}
Dim results As BarcodeResults = BarcodeReader.Read("shipping-label.png", options)
' Still check for null and empty even with a threshold applied;
' an image with no barcodes returns an empty collection, not null
If results Is Nothing OrElse results.Count = 0 Then
Console.WriteLine("No barcodes met the confidence threshold.")
Return
End If
For Each result In results
Console.WriteLine($"Type: {result.BarcodeType}, Value: {result.Value}")
Next바코드 쓰기에 널 안전 패턴을 적용하는 방법?
BarcodeWriter.CreateBarcode는 문자열 값 및 BarcodeWriterEncoding 또는 BarcodeEncoding 열거형을 받습니다. null 또는 빈 문자열을 전달하면 즉시 예외가 발생합니다. 형식 제약도 적용됩니다: EAN-8는 7에서 8자리의 숫자를 허용하며, UPC-A는 11에서 12자리, Code 128는 문자 제한이 있습니다. 함수 호출 전에 입력값을 검증하면 이러한 예외가 인코딩 단계에 포함되지 않습니다.
using IronBarCode;
// Input may arrive from user input, a database, or an API response
string inputValue = GetValueFromUserOrDatabase(); // Could be null
// Guard: null, empty, or whitespace input cannot produce a valid barcode
if (string.IsNullOrWhiteSpace(inputValue))
{
Console.WriteLine("Cannot generate barcode: input value is null or empty.");
return;
}
// Guard: format-specific constraints must be satisfied before encoding
// EAN-8 accepts exactly 7 or 8 numeric digits (the 8th is the check digit)
BarcodeWriterEncoding encoding = BarcodeWriterEncoding.EAN8;
if (encoding == BarcodeWriterEncoding.EAN8 && !System.Text.RegularExpressions.Regex.IsMatch(inputValue, @"^\d{7,8}$"))
{
Console.WriteLine("EAN-8 requires exactly 7 or 8 numeric digits.");
return;
}
// Input is validated; CreateBarcode will not throw for null or format mismatch
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(inputValue, encoding);
barcode.SaveAsPng("output-barcode.png");using IronBarCode;
// Input may arrive from user input, a database, or an API response
string inputValue = GetValueFromUserOrDatabase(); // Could be null
// Guard: null, empty, or whitespace input cannot produce a valid barcode
if (string.IsNullOrWhiteSpace(inputValue))
{
Console.WriteLine("Cannot generate barcode: input value is null or empty.");
return;
}
// Guard: format-specific constraints must be satisfied before encoding
// EAN-8 accepts exactly 7 or 8 numeric digits (the 8th is the check digit)
BarcodeWriterEncoding encoding = BarcodeWriterEncoding.EAN8;
if (encoding == BarcodeWriterEncoding.EAN8 && !System.Text.RegularExpressions.Regex.IsMatch(inputValue, @"^\d{7,8}$"))
{
Console.WriteLine("EAN-8 requires exactly 7 or 8 numeric digits.");
return;
}
// Input is validated; CreateBarcode will not throw for null or format mismatch
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(inputValue, encoding);
barcode.SaveAsPng("output-barcode.png");Imports IronBarCode
' Input may arrive from user input, a database, or an API response
Dim inputValue As String = GetValueFromUserOrDatabase() ' Could be Nothing
' Guard: null, empty, or whitespace input cannot produce a valid barcode
If String.IsNullOrWhiteSpace(inputValue) Then
Console.WriteLine("Cannot generate barcode: input value is null or empty.")
Return
End If
' Guard: format-specific constraints must be satisfied before encoding
' EAN-8 accepts exactly 7 or 8 numeric digits (the 8th is the check digit)
Dim encoding As BarcodeWriterEncoding = BarcodeWriterEncoding.EAN8
If encoding = BarcodeWriterEncoding.EAN8 AndAlso Not System.Text.RegularExpressions.Regex.IsMatch(inputValue, "^\d{7,8}$") Then
Console.WriteLine("EAN-8 requires exactly 7 or 8 numeric digits.")
Return
End If
' Input is validated; CreateBarcode will not throw for null or format mismatch
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(inputValue, encoding)
barcode.SaveAsPng("output-barcode.png")Imports IronBarCode
' Input may arrive from user input, a database, or an API response
Dim inputValue As String = GetValueFromUserOrDatabase() ' Could be Nothing
' Guard: null, empty, or whitespace input cannot produce a valid barcode
If String.IsNullOrWhiteSpace(inputValue) Then
Console.WriteLine("Cannot generate barcode: input value is null or empty.")
Return
End If
' Guard: format-specific constraints must be satisfied before encoding
' EAN-8 accepts exactly 7 or 8 numeric digits (the 8th is the check digit)
Dim encoding As BarcodeWriterEncoding = BarcodeWriterEncoding.EAN8
If encoding = BarcodeWriterEncoding.EAN8 AndAlso Not System.Text.RegularExpressions.Regex.IsMatch(inputValue, "^\d{7,8}$") Then
Console.WriteLine("EAN-8 requires exactly 7 or 8 numeric digits.")
Return
End If
' Input is validated; CreateBarcode will not throw for null or format mismatch
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(inputValue, encoding)
barcode.SaveAsPng("output-barcode.png")산출
유효한 7자리 입력(1234567)은 스캔 가능한 EAN-8 바코드를 생성합니다. null, 빈 값 또는 숫자가 아닌 입력은 가드 절에 의해 포착되어 인코딩 단계에 도달하지 않습니다.

쓰기 API는 자체적인 내부 유효성 검사도 수행합니다. 체크섬을 확인하고, 길이 제약 조건을 검증하며, 선택한 인코딩에 유효하지 않은 문자를 거부합니다. 위의 가드 절은 문제를 더 일찍 포착하여 호출자가 오류 메시지와 복구 경로를 제어할 수 있도록 합니다. 지원되는 인코딩 및 그 제한의 전체 목록은 바코드 생성 방법 안내 및 데이터로부터 바코드 생성 안내를 참조하세요.
후속 처리 전 결과를 검증하는 방법?
바코드 데이터가 다른 시스템(데이터베이스 쓰기, API 호출, 라벨 프린터)으로 전송될 때, 데이터를 전달하기 전에 결과 개수, 값 무결성 및 유형 검사를 하나의 재사용 가능한 메서드로 통합하는 것이 도움이 됩니다.
입력
Code128 바코드 창고 스캔이 검증기의 읽기 대상이 됩니다.

using IronBarCode;
using System.Collections.Generic;
using System.Linq;
// Reusable validation helper — consolidates null, empty, value, and
// expected-format checks into a single method. Returns an empty list
// (never null) so callers do not need to null-check the return value.
public static class BarcodeValidator
{
public static List<BarcodeResult> GetValidResults(
string imagePath,
BarcodeEncoding? expectedType = null,
double confidenceThreshold = 0.7)
{
// Apply confidence threshold at scan level via BarcodeReaderOptions
var options = new BarcodeReaderOptions
{
ConfidenceThreshold = confidenceThreshold
};
BarcodeResults results = BarcodeReader.Read(imagePath, options);
// Return empty list instead of null so callers never need to null-check the return value
if (results is null || results.Count == 0)
return new List<BarcodeResult>();
return results
.Where(r => !string.IsNullOrWhiteSpace(r.Value)) // skip results with empty decoded data
.Where(r => expectedType == null || r.BarcodeType == expectedType) // null accepts any symbology
.ToList();
}
}
// Usage: pass the image path and the symbology you expect
var validated = BarcodeValidator.GetValidResults(
"warehouse-scan.png",
expectedType: BarcodeEncoding.Code128,
confidenceThreshold: 0.7);
if (validated.Count == 0)
{
// No valid results; log the failure and skip downstream processing
return;
}
// All results have passed null, empty, type, and confidence checks
foreach (var barcode in validated)
{
SendToInventorySystem(barcode.Value, barcode.BarcodeType.ToString()); // placeholder for your downstream call
}using IronBarCode;
using System.Collections.Generic;
using System.Linq;
// Reusable validation helper — consolidates null, empty, value, and
// expected-format checks into a single method. Returns an empty list
// (never null) so callers do not need to null-check the return value.
public static class BarcodeValidator
{
public static List<BarcodeResult> GetValidResults(
string imagePath,
BarcodeEncoding? expectedType = null,
double confidenceThreshold = 0.7)
{
// Apply confidence threshold at scan level via BarcodeReaderOptions
var options = new BarcodeReaderOptions
{
ConfidenceThreshold = confidenceThreshold
};
BarcodeResults results = BarcodeReader.Read(imagePath, options);
// Return empty list instead of null so callers never need to null-check the return value
if (results is null || results.Count == 0)
return new List<BarcodeResult>();
return results
.Where(r => !string.IsNullOrWhiteSpace(r.Value)) // skip results with empty decoded data
.Where(r => expectedType == null || r.BarcodeType == expectedType) // null accepts any symbology
.ToList();
}
}
// Usage: pass the image path and the symbology you expect
var validated = BarcodeValidator.GetValidResults(
"warehouse-scan.png",
expectedType: BarcodeEncoding.Code128,
confidenceThreshold: 0.7);
if (validated.Count == 0)
{
// No valid results; log the failure and skip downstream processing
return;
}
// All results have passed null, empty, type, and confidence checks
foreach (var barcode in validated)
{
SendToInventorySystem(barcode.Value, barcode.BarcodeType.ToString()); // placeholder for your downstream call
}Imports IronBarCode
Imports System.Collections.Generic
Imports System.Linq
' Reusable validation helper — consolidates null, empty, value, and
' expected-format checks into a single method. Returns an empty list
' (never null) so callers do not need to null-check the return value.
Public Module BarcodeValidator
Public Function GetValidResults(
imagePath As String,
Optional expectedType As BarcodeEncoding? = Nothing,
Optional confidenceThreshold As Double = 0.7) As List(Of BarcodeResult)
' Apply confidence threshold at scan level via BarcodeReaderOptions
Dim options As New BarcodeReaderOptions With {
.ConfidenceThreshold = confidenceThreshold
}
Dim results As BarcodeResults = BarcodeReader.Read(imagePath, options)
' Return empty list instead of null so callers never need to null-check the return value
If results Is Nothing OrElse results.Count = 0 Then
Return New List(Of BarcodeResult)()
End If
Return results _
.Where(Function(r) Not String.IsNullOrWhiteSpace(r.Value)) _ ' skip results with empty decoded data
.Where(Function(r) expectedType Is Nothing OrElse r.BarcodeType = expectedType) _ ' null accepts any symbology
.ToList()
End Function
End Module
' Usage: pass the image path and the symbology you expect
Dim validated = BarcodeValidator.GetValidResults(
"warehouse-scan.png",
expectedType:=BarcodeEncoding.Code128,
confidenceThreshold:=0.7)
If validated.Count = 0 Then
' No valid results; log the failure and skip downstream processing
Return
End If
' All results have passed null, empty, type, and confidence checks
For Each barcode In validated
SendToInventorySystem(barcode.Value, barcode.BarcodeType.ToString()) ' placeholder for your downstream call
Next barcodeImports IronBarCode
Imports System.Collections.Generic
Imports System.Linq
' Reusable validation helper — consolidates null, empty, value, and
' expected-format checks into a single method. Returns an empty list
' (never null) so callers do not need to null-check the return value.
Public Module BarcodeValidator
Public Function GetValidResults(
imagePath As String,
Optional expectedType As BarcodeEncoding? = Nothing,
Optional confidenceThreshold As Double = 0.7) As List(Of BarcodeResult)
' Apply confidence threshold at scan level via BarcodeReaderOptions
Dim options As New BarcodeReaderOptions With {
.ConfidenceThreshold = confidenceThreshold
}
Dim results As BarcodeResults = BarcodeReader.Read(imagePath, options)
' Return empty list instead of null so callers never need to null-check the return value
If results Is Nothing OrElse results.Count = 0 Then
Return New List(Of BarcodeResult)()
End If
Return results _
.Where(Function(r) Not String.IsNullOrWhiteSpace(r.Value)) _ ' skip results with empty decoded data
.Where(Function(r) expectedType Is Nothing OrElse r.BarcodeType = expectedType) _ ' null accepts any symbology
.ToList()
End Function
End Module
' Usage: pass the image path and the symbology you expect
Dim validated = BarcodeValidator.GetValidResults(
"warehouse-scan.png",
expectedType:=BarcodeEncoding.Code128,
confidenceThreshold:=0.7)
If validated.Count = 0 Then
' No valid results; log the failure and skip downstream processing
Return
End If
' All results have passed null, empty, type, and confidence checks
For Each barcode In validated
SendToInventorySystem(barcode.Value, barcode.BarcodeType.ToString()) ' placeholder for your downstream call
Next barcode이 메서드는 null이 아닌 빈 리스트를 반환하므로 호출자는 반환 값에 대해 null 검사를 할 필요가 없습니다. 선택적 expectedType 매개변수는 심볼로지를 기준으로 필터링하여 스캔이 동일한 이미지에서 QR 코드와 Code 128를 모두 인식할 때 다운스트림 시스템에 예상치 못한 형식이 전달되는 것을 방지합니다.
여러 파일에 걸쳐 배치 읽기를 위해 각 파일에 동일한 패턴을 적용하고 결과를 집계합니다. ExpectBarcodeTypes 옵션은 BarcodeReaderOptions에서 스캔을 예상되는 심볼로지로 좁혀서 원치 않는 결과가 검증기에 도달하기 전에 줄어듭니다.
추가 자료
- 바코드 읽기 튜토리얼: 스캔 설정 및 읽기 옵션.
- 출력 데이터 형식 가이드: 모든
BarcodeResult속성과 해당 유형. - 데이터로 바코드 생성: 각 심볼로지에 대한 인코딩 제약.
- BarcodeReaderOptions API 레퍼런스: 완전한 구성 문서.
- IronBarcode 변경 로그: 버전 특정 수정 및 기능 추가.
파이프라인이 프로덕션 준비 상태가 되었을 때 라이선스 옵션 보기.
자주 묻는 질문
IronBarcode에서 BarcodeResults란 무엇이며 널 체크에 어떤 영향을 미칩니까?
BarcodeResults는 IronBarcode의 BarcodeReader.Read 메서드가 반환하는 컬렉션입니다. 입력 이미지가 유효하지 않은 경우 널이 되고, 바코드가 감지되지 않으면 비어 있게 되며, 런타임 예외를 피하기 위해 적절한 널 체킹이 필요합니다.
어떻게 보호 절차가 IronBarcode 작업에서의 예외를 방지할 수 있습니까?
보호 절차는 읽기 및 쓰기 작업 모두에서 적용되어 진행 전에 널이나 유효하지 않은 입력을 확인하여, 생산에서 NullReferenceException 및 ArgumentException 같은 예외를 방지합니다.
null 또는 빈 문자열을 BarcodeWriter.CreateBarcode에 전달하면 어떻게 됩니까?
BarcodeWriter.CreateBarcode에 널 또는 빈 문자열을 전달하면 즉시 예외가 발생합니다. 호출 전에 입력 검증은 이러한 예외를 피하여 안정적인 인코딩 프로세스를 유지합니다.
ConfidenceThreshold가 IronBarcode의 BarcodeReader에 어떤 영향을 미칩니까?
ConfidenceThreshold는 스캐닝 중 저품질의 읽기를 필터링하는 BarcodeReaderOptions의 속성입니다. 이 임계값 이하의 읽기는 결과 컬렉션에 도달하지 않도록 폐기되어 스캔 품질을 향상합니다.
IronBarcode가 단일 스캔에서 여러 바코드 유형을 처리할 수 있습니까?
네, IronBarcode는 단일 스캔에서 여러 유형을 처리할 수 있습니다. BarcodeReaderOptions와 예를 들어 ExpectBarcodeTypes와 같은 설정을 사용하면 특정 심볼로지를 중심으로 읽기를 집중시켜 혼합 콘텐츠 이미지를 효과적으로 관리할 수 있습니다.
하위 처리 전에 BarcodeResults를 검증해야 하는 이유는 무엇입니까?
BarcodeResults를 검증하여 결과 수, 값 무결성 및 유형 일관성을 보장함으로써 데이터베이스 쓰기, API 호출 및 기타 시스템 상호작용에 부정확한 데이터가 영향을 미치는 것을 방지합니다.
IronBarcode 작업에서 널 결과를 체크하지 않을 때의 영향은 무엇입니까?
널 결과를 체크하지 않으면 스캐닝 작업 중 NullReferenceExceptions이 발생할 수 있습니다. 존재하지 않는 BarcodeResult의 속성을 액세스하면 실패할 것입니다.
IronBarcode의 재사용 가능한 검증자 패턴은 어떻게 작동합니까?
IronBarcode의 재사용 가능한 검증자 패턴은 널 체크, 빈 체크, 값 무결성 및 예상 형식 검증을 하나의 메서드로 통합하여 결과가 하위에서 사용되기 전에 검증 과정을 단순화합니다.
BarcodeWriterEncoding이 바코드 생성 중 처리하는 제한은 무엇입니까?
BarcodeWriterEncoding은 바코드 타입에 따라 문자열 길이와 문자 유효성 같은 제한을 부과합니다. 예를 들어, EAN-8은 7 또는 8개의 숫자만 가져야 합니다. 올바르게 형식화된 입력은 인코딩 중 예외를 피합니다.
IronBarcode는 스캔된 바코드의 품질을 어떻게 보장합니까?
IronBarcode는 BarcodeReaderOptions의 ConfidenceThreshold와 같은 속성을 사용하여 높은 품질의 바코드만 결과에 포함되도록 보장합니다. 이 사전 스캔 필터는 저품질의 읽기를 추가 처리 전에 폐기하게 합니다.
커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.