Group “Ltd” and “Limited” together.
dotnet add package RecursiveAI.OneContactRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using RecursiveAI.OneContact; string[] names = ["Lumen Quay Ltd", "LUMEN QUAY LIMITED"]; var unique = names.DistinctBy(name => CompanyName.Parse(name) .GetKey(KeyVersion.V1)); Console.WriteLine(string.Join(", ", unique));
Unzip the example, then dotnet run.
Lumen Quay LtdFull program
using RecursiveAI.OneContact; string[] names = [ "Lumen Quay Ltd", "LUMEN QUAY LIMITED", "Lumen Quay", "Lumen Quay Inc", "Lumen Qauy Limited", // Intentional typo: a separate group. "", ]; var parsed = new List<(string Original, string Key)>(); foreach (string name in names) { if (CompanyName.TryParse(name, out var company)) parsed.Add((name, company.GetKey(KeyVersion.V1))); else Console.WriteLine("Skipped: empty or unparseable name"); } foreach (var group in parsed.GroupBy(item => item.Key, StringComparer.Ordinal)) { Console.WriteLine(group.Key); foreach (var item in group) Console.WriteLine($" {item.Original}"); }
dotnet run prints:
Skipped: empty or unparseable name lumen quay|~ltd Lumen Quay Ltd LUMEN QUAY LIMITED lumen quay| Lumen Quay lumen quay|~inc Lumen Quay Inc lumen qauy|~ltd Lumen Qauy Limited
The program groups the original strings instead of discarding them, so you can see why each row landed in its group. If TryParse returns false, it skips that row rather than grouping it under a blank key.
Variations
See the base name and parsed legal suffix before deciding how to label a group. Region.Parse("GB") narrows the legal-form candidates to UK matches when available:
using RecursiveAI.OneContact; var company = CompanyName.Parse( "Lumen Quay Limited", Region.Parse("GB")); Console.WriteLine(company.Base); Console.WriteLine(company.LegalForm?.Abbreviation);
Lumen Quay Ltd
Related recipes
The short answer
To deduplicate a list of company names in C#, parse each name with CompanyName and compare GetKey(KeyVersion.V1) using ordinal string equality. Use DistinctBy for one label per key, or GroupBy to retain the originals for review. In the example, both spellings of Lumen Quay Limited produce lumen quay|~ltd. Neither the company with no suffix nor the one ending in Inc joins that group.
How do you remove duplicates from a list of similar company names?
Group on the key, not on the input text. Case-insensitive comparison alone won’t match “Ltd” to “Limited”. The company name rules fold the base to lowercase words, treat & like “and”, and leave out the leading “The”, trading-as name and care-of text. The library doesn’t correct the base name. “Lumen Qauy Limited” stays in a different group even though a reader might guess it’s a typo.
If all you need is a dropdown of representative labels, you can use the compact version above. If you’re cleaning CRM rows, save the source row IDs alongside the key and choose the label explicitly, for example from the record with a verified registered name. That keeps a spelling found in an import from silently replacing a name you’ve already checked. Keep parse failures apart from the valid groups so you can fix or exclude them deliberately.
What is a suffix in a company name?
A suffix like “Limited” is part of the company’s legal form, not just punctuation. OneContact looks for known forms and abbreviations, preferring the longest match at the end of the name. In V1, the part after | is an ISO 20275 Entity Legal Form code when the written form maps to one code; otherwise the parser can use a ~ token based on the common abbreviation, such as ~ltd. If there is no legal form, the part after | is empty. Don’t strip that part of the key if the distinction matters to your list.
Can two companies have the same normalized name?
Yes. A key contains name information, not a registration number or a lookup in a company register. Even the legal-form code describes the type of entity, not which entity it is. Treat a key match as a group of candidates. Before you merge legal-entity records, compare a reliable identifier, such as a registration number together with its jurisdiction. Where one name lacks a suffix or has a likely typo, send it to review instead of merging it just because the names look alike.