---
title: "Split multiple people’s names in C#"
url: https://recursiveai.org/onecontact/cookbook/split-multiple-person-names/
description: "Split multiple people’s names in C#: runnable OneContact example, real output and regional or ambiguity rules."
version: "1.0.0"
---

# Split multiple people’s names 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/split-multiple-person-names/split-multiple-person-names.zip)

Split a shared-name entry such as “John and Jane Smith” into separate people.

```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.Names;
var results = NameParsing.SplitMany(
    new[] { "John and Jane Smith" });
foreach (var result in results)
{
    Console.WriteLine(result.Class);
    foreach (var person in result.Persons)
        Console.WriteLine(person.Canonical);
}
```

```text
Multiple
John Smith
Jane Smith
```

Unsettled input is returned as `Unknown`; inspect `Class` and `Detail` rather than treating every returned part as an identified person.

Unzip [the example](https://recursiveai.org/onecontact/cookbook/split-multiple-person-names/split-multiple-person-names.zip), then `dotnet run`.

## Variations

Leave an ambiguous ampersand pair unresolved:

```csharp
using RecursiveAI.OneContact.Names;
var result = NameParsing.Split(
    "Johnson & Johnson");
Console.WriteLine(result.Class);
Console.WriteLine(result.Persons.Count);
```

```text
Unknown
0
```

## Related recipes

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

## The short answer

Use `NameParsing.Split` for one entry, or `NameParsing.SplitMany` for a collection of entries. Each result has a `Class`, a `Persons` collection and diagnostic `Detail`. A single entry can yield several people: the snippet at the top passes one entry through the batch API and receives `John Smith` and `Jane Smith`.

`SplitMany` does not take a single multi-person string as its batch argument. It takes an `IEnumerable<string>` and yields one `NameParseResult` per input entry. The distinction matters when importing a column: preserve the link between each source row and its result, even when that result contains several people.

## How do I split multiple people’s names in C#?

Iterate the results, inspect each `Class`, and then decide whether to accept its `Persons`. The example prints the class before the names so a caller can see that the text was read as `Multiple`. In an import workflow, keep `Unknown` and `Company` entries for separate handling instead of silently dropping them.

The [name rules](https://recursiveai.org/onecontact/docs/names/#classes) recognize connectors, semicolons, line breaks and certain comma lists. A lone given name before a full name can share the following family name, as in the example. Titles also matter: in `Mr & Mrs John Smith`, a title-only part takes the whole name that follows. This is structured name interpretation, not merely cutting text at an ampersand.

The rules do not infer gender, origin or salutation. They preserve offsets into the original input; when two people share a written family name, their offsets can point to the same source text. Store the input if you need to show how the names were derived or allow someone to correct the reading.

## How do I split a string with multiple delimiters in C#?

For known mechanical separators, `string.Split` is appropriate. Microsoft’s [string-splitting guide](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/strings/common-tasks/split) covers arrays of separators and empty-entry handling. But a name field has semantic boundaries: a comma may mark family-first order, and a connector may belong inside one person’s family name.

Use the name parser when those distinctions matter. The documented example `Maria Garcia y Lopez` is one person, not two. Every proposed person must also read as a person when parsed alone, or the whole text becomes `Unknown`. A delimiter-only split loses that check and cannot decide when to share a surname.

## How do I split full names into first and last names in C#?

First separate the people; then read each `PersonName`’s `Given`, `Middle` and `Family` parts as needed. Do not reverse those stages by taking the first word of the entire household entry as one person’s first name and the last word as their surname. That would discard the other person entirely.

The variation returns `Unknown` and no people for `Johnson & Johnson`. Two single words joined by a connector count as multiple people only when the first is a known given name. Leave that refusal intact instead of fabricating two contact records. Country and language hints can choose between readings left open by the text, but never overrule the text. Successful parsing is still a rules-based reading, not identity verification; keep a correction path for imports and forms.
