METHOD

Enumerable.LeftJoin

In .NET 10, correlates by key and retains unmatched left elements. Duplicate matching keys create multiple pairs; a missing reference-type right element is null. A missing value-type element uses its default, so project presence explicitly when needed.

Formal Syntax & Structure

csharp syntaxcsharp
outer.LeftJoin(inner, outerKey, innerKey, resultSelector)

Working Example

Example Snippetcsharp
using System;using System.Collections.Generic;using System.Linq;Console.WriteLine(string.Join(",", new[] { "A", "B" }.LeftJoin(new[] { "B" }, x => x, y => y, (x, y) => x + ":" + (y ?? "none")))); // A:none,B:B
C# & .NET Reference