Modernize C# snippets (System.Collections.Generic) - #13005
Open
gewarren wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Modernizes System.Collections.Generic C# documentation snippets and adds .NET 10 compilation harnesses for multi-example directories.
Changes:
- Adopts collection expressions, target-typed
new, built-in aliases, and consistent formatting. - Renames conflicting entry points and adds shared runners.
- Adds .NET 10 projects and removes an obsolete package reference.
Reviewed changes
Copilot reviewed 92 out of 92 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs |
Modernizes stack syntax. |
snippets/csharp/System.Collections.Generic/SortedSetT/Overview/program.cs |
Modernizes set construction and formatting. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/System.Collections.IDictionary.Add/source.cs |
Modernizes initialization and loops. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/source.cs |
Modernizes the overview example. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/remarks.cs |
Modernizes the remarks example. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/Overview/Program.cs |
Runs overview examples. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/.ctor/source4.cs |
Modernizes constructor example 5. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/.ctor/source3.cs |
Modernizes constructor example 4. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/.ctor/source2.cs |
Modernizes constructor example 3. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/.ctor/source1.cs |
Modernizes constructor example 2. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/.ctor/source.cs |
Modernizes constructor example 1. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/.ctor/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/SortedListTKey,TValue/.ctor/Program.cs |
Runs constructor examples. |
snippets/csharp/System.Collections.Generic/SortedDictionaryTKey,TValue/System.Collections.IDictionary.Add/source.cs |
Modernizes initialization and loops. |
snippets/csharp/System.Collections.Generic/SortedDictionaryTKey,TValue/Overview/source.cs |
Modernizes the overview example. |
snippets/csharp/System.Collections.Generic/SortedDictionaryTKey,TValue/.ctor/source2.cs |
Modernizes constructor example 3. |
snippets/csharp/System.Collections.Generic/SortedDictionaryTKey,TValue/.ctor/source1.cs |
Modernizes constructor example 2. |
snippets/csharp/System.Collections.Generic/SortedDictionaryTKey,TValue/.ctor/source.cs |
Modernizes constructor example 1. |
snippets/csharp/System.Collections.Generic/SortedDictionaryTKey,TValue/.ctor/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/SortedDictionaryTKey,TValue/.ctor/Program.cs |
Runs constructor examples. |
snippets/csharp/System.Collections.Generic/QueueT/Overview/source.cs |
Modernizes queue syntax. |
snippets/csharp/System.Collections.Generic/ListT/Sort/Sort1.cs |
Modernizes and namespaces sort example 1. |
snippets/csharp/System.Collections.Generic/ListT/Sort/RunExamples.cs |
Runs sort examples. |
snippets/csharp/System.Collections.Generic/ListT/Sort/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/ListT/Sort/program.cs |
Modernizes and namespaces sort example 2. |
snippets/csharp/System.Collections.Generic/ListT/Reverse/source.cs |
Modernizes list initialization and loops. |
snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs |
Modernizes overview example 1. |
snippets/csharp/System.Collections.Generic/ListT/Overview/RunExamples.cs |
Runs list overview examples. |
snippets/csharp/System.Collections.Generic/ListT/Overview/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/ListT/Overview/program.cs |
Modernizes overview example 2. |
snippets/csharp/System.Collections.Generic/ListT/LastIndexOf/source.cs |
Modernizes list initialization. |
snippets/csharp/System.Collections.Generic/ListT/IndexOf/source.cs |
Modernizes list initialization. |
snippets/csharp/System.Collections.Generic/ListT/FindIndex/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/ListT/FindIndex/Program.cs |
Runs FindIndex examples. |
snippets/csharp/System.Collections.Generic/ListT/FindIndex/FindIndex3.cs |
Modernizes and namespaces example 3. |
snippets/csharp/System.Collections.Generic/ListT/FindIndex/FindIndex2.cs |
Modernizes and namespaces example 2. |
snippets/csharp/System.Collections.Generic/ListT/FindIndex/FindIndex1.cs |
Modernizes and namespaces example 1. |
snippets/csharp/System.Collections.Generic/ListT/Find/program.cs |
Modernizes Find examples. |
snippets/csharp/System.Collections.Generic/ListT/Exists/source.cs |
Modernizes list and string syntax. |
snippets/csharp/System.Collections.Generic/ListT/CopyTo/source.cs |
Modernizes list initialization and loops. |
snippets/csharp/System.Collections.Generic/ListT/Contains/program1.cs |
Modernizes part-list initialization. |
snippets/csharp/System.Collections.Generic/ListT/Contains/program.cs |
Modernizes cube-list initialization. |
snippets/csharp/System.Collections.Generic/ListT/Capacity/program.cs |
Uses an empty collection expression. |
snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source2.cs |
Modernizes and namespaces example 3. |
snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source1.cs |
Modernizes and namespaces example 2. |
snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source.cs |
Modernizes and namespaces example 1. |
snippets/csharp/System.Collections.Generic/ListT/BinarySearch/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/ListT/BinarySearch/Program.cs |
Runs BinarySearch examples. |
snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs |
Converts the example into a runnable class. |
snippets/csharp/System.Collections.Generic/ListT/.ctor/source.cs |
Renames the constructor example. |
snippets/csharp/System.Collections.Generic/ListT/.ctor/RunExamples.cs |
Runs list constructor examples. |
snippets/csharp/System.Collections.Generic/LinkedListT/Overview/source.cs |
Modernizes linked-list syntax and output comments. |
snippets/csharp/System.Collections.Generic/LinkedListT/.ctor/llctor.cs |
Uses aliases and target-typed construction. |
snippets/csharp/System.Collections.Generic/LinkedListNodeT/Overview/llnctor.cs |
Modernizes formatting and construction. |
snippets/csharp/System.Collections.Generic/IEnumerableT/Overview/program.cs |
Modernizes formatting and collection syntax. |
snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source2.cs |
Modernizes overview example 2. |
snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source.cs |
Modernizes overview example 1. |
snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/Program.cs |
Runs interface overview examples. |
snippets/csharp/System.Collections.Generic/ICollectionT/Overview/program.cs |
Modernizes collection initialization and formatting. |
snippets/csharp/System.Collections.Generic/HashSetT/SymmetricExceptWith/Program.cs |
Uses empty collection expressions. |
snippets/csharp/System.Collections.Generic/HashSetT/Overview/Program.cs |
Modernizes set construction. |
snippets/csharp/System.Collections.Generic/HashSetT/IsProperSubsetOf/Program.cs |
Modernizes set construction and comments. |
snippets/csharp/System.Collections.Generic/HashSetT/Contains/Program.cs |
Modernizes construction and braces. |
snippets/csharp/System.Collections.Generic/HashSetT/Clear/Program.cs |
Uses an empty collection expression. |
snippets/csharp/System.Collections.Generic/HashSetT/.ctor/source2.cs |
Modernizes constructor example 2. |
snippets/csharp/System.Collections.Generic/HashSetT/.ctor/RunExamples.cs |
Runs HashSet constructor examples. |
snippets/csharp/System.Collections.Generic/HashSetT/.ctor/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/HashSetT/.ctor/Program.cs |
Converts example 1 to a shared runner. |
snippets/csharp/System.Collections.Generic/EqualityComparerT/Overview/program.cs |
Uses aliases and target-typed construction. |
snippets/csharp/System.Collections.Generic/EqualityComparerT/Default/program.cs |
Replaces inferred locals with explicit types. |
snippets/csharp/System.Collections.Generic/EqualityComparerT/Default/cs.csproj |
Removes the obsolete ValueTuple package. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/System.Collections.IDictionary.Values/source.cs |
Modernizes dictionary initialization and loops. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/System.Collections.IDictionary.Remove/source.cs |
Modernizes dictionary initialization. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/System.Collections.IDictionary.Keys/source.cs |
Modernizes dictionary initialization and loops. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/System.Collections.IDictionary.Item/source.cs |
Modernizes dictionary initialization. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/System.Collections.IDictionary.GetEnumerator/source.cs |
Modernizes initialization and enumeration. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/System.Collections.IDictionary.Contains/source.cs |
Modernizes dictionary initialization. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/System.Collections.IDictionary.Add/source.cs |
Modernizes initialization and loops. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source2.cs |
Modernizes overview example 2. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/source.cs |
Modernizes overview example 1. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/Overview/Program.cs |
Runs dictionary overview examples. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/.ctor/source4.cs |
Modernizes constructor example 5. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/.ctor/source3.cs |
Modernizes constructor example 4. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/.ctor/source2.cs |
Modernizes constructor example 3. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/.ctor/source1.cs |
Modernizes constructor example 2. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/.ctor/source.cs |
Modernizes constructor example 1. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/.ctor/Project.csproj |
Adds a .NET 10 project. |
snippets/csharp/System.Collections.Generic/DictionaryTKey,TValue/.ctor/Program.cs |
Runs dictionary constructor examples. |
snippets/csharp/System.Collections.Generic/ComparerT/Overview/program.cs |
Modernizes comparer example construction. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
gewarren
marked this pull request as ready for review
August 19, 2026 19:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes to #12713.
Internal previews
Toggle expand/collapse
Note
This table shows the first 30 preview links (sorted alphabetically by file path) found in the OPS build report. For the full list, select OpenPublishing.Build Details within checks.