Skip to content

Add countby example#12534

Open
mahmoudbakeer wants to merge 15 commits intodotnet:mainfrom
mahmoudbakeer:add-countby-examples
Open

Add countby example#12534
mahmoudbakeer wants to merge 15 commits intodotnet:mainfrom
mahmoudbakeer:add-countby-examples

Conversation

@mahmoudbakeer
Copy link
Copy Markdown
Contributor

Summary

This PR adds a comprehensive code example to the Enumerable.CountBy documentation to illustrate its behavior and practical use case.

The added example demonstrates:

  • CountByDepartmentExample: Grouping and counting elements in a collection by a specific property (e.g., counting the number of employees per department using a tuple array).

The XML documentation has been updated in Enumerable.xml to include the Snippet209 reference, 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 17, 2026 10:43
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Apr 17, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-linq

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example should go in a folder named /System.Linq/Enumerable/CountBy.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also fix the directories for your other PRs where I overlooked that detail:

#12518
#12486

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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