Getting Started

Requirements

  • .NET 8 SDK
  • Visual Studio 2022 or another .NET 8-compatible IDE

Reference the project

Add a project reference to EDIParser.Core:

<ItemGroup>
  <ProjectReference Include="..\src\EDIParser.Core\EDIParser.Core.csproj" />
</ItemGroup>

Parse a message

using EDIParser;

var parser = new X12Parser
{
    Message = File.ReadAllText("purchase-order.edi")
};

parser.ParseMsg();

Console.WriteLine($"Segments: {parser.SegmentCount}");

Read a value

The parser uses one-based EDI positions:

var purchaseOrderNumber = parser.GetValue("BEG.3", 1, 1);

Modify a value

parser.SetValue("BEG.3", "PO-10025", 1, 1);

Generate the message

var output = parser.GenerateMessage();
File.WriteAllText("purchase-order-updated.edi", output);
Note

Exact parser member names may vary by class. Use the generated API reference for the authoritative signatures.