Skip to content

HashSet vs SortedSet in C#: .NET 10, fixed RemoveWhere benchmarks, set order examples - #2318

Merged
vladimir-pecanac-main merged 3 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/77221-csharp-hashset-vs-sortedset
Oct 23, 2026
Merged

vladimir-pecanac-main merged 3 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/77221-csharp-hashset-vs-sortedset

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Moves the HashSet vs SortedSet sample to .NET 10 with BenchmarkDotNet 0.15.8 and MSTest 4.5.1, and passes the command-line arguments through to BenchmarkRunner. The two RemoveWhere benchmarks now run on fresh copies of both sets from an IterationSetup, so every run actually removes elements instead of scanning sets that the first run already emptied. Sorting the HashSet uses Order(), the helpers are static, and the code uses collection expressions and file-scoped namespaces. A new SetOrderExamples class holds the article's order demo, the OrderedDictionary example for insertion order and the year-comparer books example, with five new tests that pin their output.

@vladimir-pecanac-main
vladimir-pecanac-main merged commit 80ff2dd into CodeMazeBlog:main Oct 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant