---
title: GeSegment
summary: API reference for GeSegment.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common.Files
reference_type: package
---

# GeSegment

`GeSegment` models the X12 GE functional group trailer, the closing segment that pairs with a `GsSegment` header to bound a functional group within an EDI interchange envelope, reporting how many transaction sets the group contained and echoing the group's control number for pairing validation*.

## Purpose
- Represents the GE segment identity via `SegmentId` returning the literal `"GE"` ([BR-020](../../business-rules.md#br-020-first-element-is-the-segment-identifier)).
- Carries `NumberOfSets`, the count of transaction sets included in the functional group being closed.
- Carries `ControlNumber`, echoing the matching `GsSegment.ControlNumber` so the group parser can pair GS/GE segments together.

## Context
- Namespace: `SAIF.Common.Files.Edi.Segments`
- Assembly/package: `SAIF.Framework.Common.Files`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| SegmentId | `string SegmentId { get; }` | Returns the literal X12 segment identifier `"GE"`. |
| NumberOfSets | `int NumberOfSets { get; set; }` | The number of transaction sets included in the functional group (GE01), element 1. |
| ControlNumber | `long ControlNumber { get; set; }` | The group control number matching the paired `GsSegment.ControlNumber` (GE02), element 2. |
| Build | `IEdiSegment Build()` | Creates a `SegmentBuilder("GE")` and adds `NumberOfSets` and `ControlNumber` at elements 1-2, returning the built segment. |
| Fill | `void Fill(IEdiSegment segment)` | Reads elements 1-2 via `GetChildValue`, converting to `int`/`long`, into `NumberOfSets` and `ControlNumber`. |
| Parse | `static GeSegment Parse(IEdiSegment segment)` | Instantiates a new `GeSegment`, calls `Fill(segment)` on it, and returns it. |

## Behavioral notes
- The class carries a code comment noting its field layout resembles the GS segment's positions*.

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources
- Common\SAIF.Common.Files\Edi\Segments\GeSegment.cs
