Search Results for

    Show / Hide Table of Contents

    Class Code128EncodingSegment

    Represents a segment of data encoded with a specific Code 128 character set.

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

    One contiguous run of Code 128 data encoded under a single character set is described by Code128EncodingSegment. A Code 128 barcode rarely stays in one set: the encoder shifts between sets A, B, and C to pack control codes, mixed text, and digit pairs efficiently, and each shift starts a new segment. A developer reaches for this object when the goal is to understand, run by run, exactly how a payload was laid out inside the symbol.

    A segment sits inside the Segments list on Code128EncodingInfo, so a developer obtains it by inspecting an encoding report rather than constructing it directly. The object pins the run to its place and set. CharacterSet returns the Code128CharacterSet value that encoded the run, with CharacterSetName and CharacterSetShort giving readable and abbreviated labels for that set. Data holds the characters this run carried.

    The position and size fields locate and measure the run. StartPosition is the run's offset within the original data, Length is how many source characters it covers, and SymbolCount is how many barcode symbols it consumed once encoded. Reading these together shows where a costly set switch happened and how many symbols it added, which is the practical way to explain why one input produced a wider barcode than another. The segment is read-only detail describing a finished encoding, so treat it as a measurement rather than a setting. The output data formats how-to shows how to surface these results, and the reading barcodes tutorial covers the surrounding read workflow.

    using IronBarCode;
    
    foreach (Code128EncodingSegment segment in info.Segments)
        Console.WriteLine(
            $"{segment.CharacterSetName} @ {segment.StartPosition}: {segment.Data} ({segment.SymbolCount} symbols)");

    The checksum and format validation how-to walks through validating encoded data.

    Constructors

    Code128EncodingSegment()

    Declaration
    public Code128EncodingSegment()

    Properties

    CharacterSet

    The character set used for this segment.

    Declaration
    public Code128CharacterSet CharacterSet { get; }
    Property Value
    Type Description
    Code128CharacterSet

    CharacterSetName

    Gets the character set as a string (e.g., "Code A", "Code B", "Code C").

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

    CharacterSetShort

    Gets a short representation of the character set (A, B, or C).

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

    Data

    The raw data content of this segment.

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

    Length

    The length of the data in the original input string.

    Declaration
    public int Length { get; }
    Property Value
    Type Description
    System.Int32

    StartPosition

    The starting position in the original input string.

    Declaration
    public int StartPosition { get; }
    Property Value
    Type Description
    System.Int32

    SymbolCount

    Number of Code 128 symbols required to encode this segment.

    Declaration
    public int SymbolCount { get; }
    Property Value
    Type Description
    System.Int32

    Methods

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget