---
title: "Parse a company name and legal suffix in C#"
url: https://recursiveai.org/onecontact/cookbook/parse-company-name/
description: "Parse a company name and legal suffix in C#: runnable OneContact example, real output and regional or ambiguity rules."
version: "1.0.0"
---

# Parse a company name and legal suffix in C#

**OneContact** is a free, open-source contact data library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies, no network access.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneContact) · [GitHub](https://github.com/recursive-ai-oss/onecontact-csharp) · [Docs](https://recursiveai.org/onecontact/docs/) · [Download example (.zip)](https://recursiveai.org/onecontact/cookbook/parse-company-name/parse-company-name.zip)

Separate a company’s base name from its legal form and trading name.

```shell
dotnet add package RecursiveAI.OneContact
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
using RecursiveAI.OneContact;
var company = CompanyName.Parse(
    "Acme Limited", Region.Parse("GB"));
Console.WriteLine(company.Base);
Console.WriteLine(
    company.LegalForm?.Abbreviation);
```

```text
Acme
Ltd
```

CompanyName.Parse throws `ContactParseException` for rejected input; an ambiguous legal form can still parse, with an empty ELF code (the ISO 20275 legal-form code) and multiple candidates.

Unzip [the example](https://recursiveai.org/onecontact/cookbook/parse-company-name/parse-company-name.zip), then `dotnet run`.

## Variations

Read the leading article and trading name separately:

```csharp
using RecursiveAI.OneContact;
var company = CompanyName.Parse(
    "The Acme Limited d/b/a Acme Shop",
    Region.Parse("GB"));
Console.WriteLine(company.LeadingArticle);
Console.WriteLine(company.Base);
Console.WriteLine(company.TradingAs);
```

```text
The
Acme
Acme Shop
```

## Related recipes

- [Parse one person’s name](https://recursiveai.org/onecontact/cookbook/parse-person-name/)

## The short answer

Use `CompanyName.Parse(text, country)` and read `Base` and `LegalForm`. The snippet at the top separates `Acme Limited` into `Acme` and the canonical abbreviation `Ltd`, with an explicit British country hint. Keep the source text alongside those fields: parsing a written legal form does not establish a company’s legal identity or registration status.

The [company-name documentation](https://recursiveai.org/onecontact/docs/company-names/) describes a rules-based parser backed by the compiled GLEIF legal-form list. It does not complete or correct the base name. A country hint narrows the legal-form candidates; it is context you supply, not a country discovered from a registry lookup.

## What is the suffix for a company name?

For this task, it is the legal-form text at the end of a company name, such as `Limited`. The parser looks for the longest matching form at the end rather than deleting the last word. This matters for composite forms, which the documentation says are kept as typed. It can also recognize certain prefix abbreviations, so a legal form does not always occupy the final position.

Read `LegalForm.Text` when you need the spelling supplied by the user, and `LegalForm.Abbreviation` when you need the canonical abbreviation. `Canonical` is the display form built from the parsed parts. These fields serve different purposes: storing only the abbreviation loses the original wording, while storing only the raw input makes it harder to compare structured parts.

## How do I parse a company name’s legal suffix in C#?

Supply the jurisdiction when you know it. The example uses `Region.Parse("GB")`; do not substitute the computer’s locale for known company context. A hinted country restricts candidates to that country’s rows when it has matching rows. If it has none, the detailed result reports that the legal form lies outside the hinted country.

Inspect `LegalForm.Candidates` and `LegalForm.ElfCode` before treating a form as resolved. The code is set only when exactly one distinct code remains. Several candidates produce an empty code and the information issue `company.legal-form-ambiguous`. A successful parse is therefore not the same as a uniquely identified legal form. An absent legal form is also different from an ambiguous one: check for null before reading it.

## How do company suffixes differ by country?

The same written abbreviation can occur in several jurisdictions. A global suffix-removal list cannot retain that distinction. The parser keeps each candidate’s country, code, name and active status, rather than inventing a unique code from an abbreviation alone. Short forms also have special matching rules: forms of at most two letters need capitals, real dotted letters or a country hint.

The variation separates `The` and `Acme Shop` from the base name. Trading-as markers such as `d/b/a` are not legal forms. Likewise, a comma between words remains part of the name, while a comma immediately before a legal form does not. Use these structured parts instead of trimming arbitrary punctuation or removing every occurrence of a legal-form word inside the base name.
