Search Results for

    Show / Hide Table of Contents

    Class ParseResult

    Represents the result of parsing structured data, containing the parsed elements and any parsing issues.

    Inheritance
    System.Object
    ParseResult
    Namespace: IronBarCode
    Assembly: IronBarCode.dll
    Syntax
    public class ParseResult : Object

    Parsing a structured barcode payload into named fields hands a developer a ParseResult. A raw Code 128 or GS1 value carries several application-identifier fields packed together, and parsing breaks that string into typed pieces while recording anything that did not check out. The result object is what a developer reads to decide whether the parse can be trusted and to reach the individual fields it produced.

    The headline is Success, a flag that says whether parsing completed cleanly, paired with Errors and Warnings, both List<string>, that explain any problems found. A developer checks Success first, then surfaces the diagnostics when it is false. The parsed data itself lives in Elements, a List<ParsedElement> where each entry holds one recognized field with its own validity state.

    The remaining members add context. FormattedString renders the parsed payload in a readable form suited to logs or a display field, and CharacterSetSummary describes the character sets the source data used. HasEncodingInfo reports whether encoding detail is available, and when it is, EncodingInfo returns the Code128EncodingInfo that documents how the symbol was packed. Checking HasEncodingInfo before reading EncodingInfo avoids a null reference when a parse produced no encoding report. Treat the result as read-only output describing one parse, iterating Elements for the data and consulting Errors for what went wrong. Because the diagnostics are separated from the data, an application can accept the valid fields and report the failed ones rather than discarding the whole read. The output data formats how-to shows how to present parsed results, and the checksum and format validation how-to covers validating the underlying values.

    using IronBarCode;
    
    if (result.Success)
        foreach (ParsedElement element in result.Elements)
            Console.WriteLine($"{element.Identifier}: {element.Data}");
    else
        Console.WriteLine(string.Join("; ", result.Errors));

    The reading barcodes tutorial covers the full read and parse workflow.

    Constructors

    ParseResult()

    Declaration
    public ParseResult()

    Properties

    CharacterSetSummary

    Gets a summary of the character sets used in the barcode encoding.

    Declaration
    public string CharacterSetSummary { get; }
    Property Value
    Type Description
    System.String

    Elements

    List of parsed elements.

    Declaration
    public List<ParsedElement> Elements { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<ParsedElement>

    EncodingInfo

    Code 128 encoding information showing how the barcode is physically encoded. Only populated when encoding analysis is requested.

    Declaration
    public Code128EncodingInfo EncodingInfo { get; set; }
    Property Value
    Type Description
    Code128EncodingInfo

    Errors

    List of errors encountered during parsing.

    Declaration
    public List<string> Errors { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    FormattedString

    Formatted string representation of the parsed data.

    Declaration
    public string FormattedString { get; set; }
    Property Value
    Type Description
    System.String

    HasEncodingInfo

    Gets whether encoding analysis has been performed.

    Declaration
    public bool HasEncodingInfo { get; }
    Property Value
    Type Description
    System.Boolean

    Success

    Indicates whether the parsing was successful.

    Declaration
    public bool Success { get; set; }
    Property Value
    Type Description
    System.Boolean

    Warnings

    List of warnings encountered during parsing.

    Declaration
    public List<string> Warnings { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget