Skip to content

Add UnionBy documentation examples#12518

Open
mahmoudbakeer wants to merge 4 commits intodotnet:mainfrom
mahmoudbakeer:add-unionby-examples
Open

Add UnionBy documentation examples#12518
mahmoudbakeer wants to merge 4 commits intodotnet:mainfrom
mahmoudbakeer:add-unionby-examples

Conversation

@mahmoudbakeer
Copy link
Copy Markdown
Contributor

Summary

This PR adds two comprehensive code examples to the Enumerable.UnionBy documentation to illustrate its behavior and practical use cases.

The added examples demonstrate:

  1. UnionByKeySelectorExample: Merging two collections while excluding duplicates based on a specific property (e.g., merging inventory arrays by ProductId).
  2. UnionByComparerExample: Merging two collections using a custom comparer to ignore case sensitivity when checking for duplicate keys (e.g., merging email lists).

These examples have been added to the <remarks> section in Enumerable.xml and the corresponding C# code has been added to snippets/csharp/System.Linq/Enumerable/AggregateTSource/enumerable.cs.

@mahmoudbakeer mahmoudbakeer requested a review from a team as a code owner April 14, 2026 22:29
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Linq community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants