Modernize C# snippets (System.Collections.Specialized) - #13006
Open
gewarren wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Modernizes System.Collections.Specialized C# snippets for issue #12713.
Changes:
- Adopts current C# syntax and formatting.
- Converts snippet projects into executable .NET 10 projects.
- Adds runners for folders containing multiple samples.
Reviewed changes
Copilot reviewed 94 out of 94 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
snippets/csharp/System.Collections.Specialized/StringEnumerator/Overview/stringenumerator.cs |
Modernizes the enumerator sample. |
snippets/csharp/System.Collections.Specialized/StringEnumerator/Overview/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/StringDictionary/Overview/stringdictionary.cs |
Modernizes the dictionary overview. |
snippets/csharp/System.Collections.Specialized/StringDictionary/Overview/source2.cs |
Modernizes and renames the synchronization sample. |
snippets/csharp/System.Collections.Specialized/StringDictionary/Overview/Project.csproj |
Adds an executable project. |
snippets/csharp/System.Collections.Specialized/StringDictionary/Overview/Program.cs |
Runs both overview samples. |
snippets/csharp/System.Collections.Specialized/StringDictionary/Count/values.cs |
Modernizes the values sample. |
snippets/csharp/System.Collections.Specialized/StringDictionary/Count/stringdictionary_enumeration.cs |
Modernizes the enumeration sample. |
snippets/csharp/System.Collections.Specialized/StringDictionary/Count/Project.csproj |
Adds an executable project. |
snippets/csharp/System.Collections.Specialized/StringDictionary/Count/Program.cs |
Runs both count samples. |
snippets/csharp/System.Collections.Specialized/StringDictionary/CopyTo/stringdictionary_copyto.cs |
Modernizes the copy sample. |
snippets/csharp/System.Collections.Specialized/StringDictionary/CopyTo/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/StringDictionary/ContainsKey/stringdictionary_contains.cs |
Modernizes the lookup sample. |
snippets/csharp/System.Collections.Specialized/StringDictionary/ContainsKey/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/StringDictionary/Add/stringdictionary_addremove.cs |
Modernizes add/remove operations. |
snippets/csharp/System.Collections.Specialized/StringDictionary/Add/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/StringCollection/Overview/stringcollection.cs |
Modernizes the collection overview. |
snippets/csharp/System.Collections.Specialized/StringCollection/Overview/remarks.cs |
Modernizes and renames the synchronization sample. |
snippets/csharp/System.Collections.Specialized/StringCollection/Overview/Project.csproj |
Adds an executable project. |
snippets/csharp/System.Collections.Specialized/StringCollection/Overview/Program.cs |
Runs both overview samples. |
snippets/csharp/System.Collections.Specialized/StringCollection/CopyTo/stringcollectioncopyto.cs |
Modernizes the copy sample. |
snippets/csharp/System.Collections.Specialized/StringCollection/CopyTo/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/StringCollection/Contains/stringcollectioncontains.cs |
Modernizes the containment sample. |
snippets/csharp/System.Collections.Specialized/StringCollection/Contains/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/StringCollection/Clear/stringcollectionremove.cs |
Modernizes removal and clearing. |
snippets/csharp/System.Collections.Specialized/StringCollection/Clear/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/StringCollection/Add/stringcollectionadd.cs |
Modernizes collection additions. |
snippets/csharp/System.Collections.Specialized/StringCollection/Add/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/OrderedDictionary/Overview/source2.cs |
Modernizes and renames the secondary sample. |
snippets/csharp/System.Collections.Specialized/OrderedDictionary/Overview/Project.csproj |
Adds an executable project. |
snippets/csharp/System.Collections.Specialized/OrderedDictionary/Overview/Program.cs |
Runs both overview samples. |
snippets/csharp/System.Collections.Specialized/OrderedDictionary/Overview/OrderedDictionary1.cs |
Modernizes dictionary operations and comments. |
snippets/csharp/System.Collections.Specialized/NameValueCollection/Overview/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/NameValueCollection/Overview/nvc.cs |
Modernizes the overview sample. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase+KeysCollection/System.Collections.ICollection.IsSynchronized/source.cs |
Modernizes the derived collection sample. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase+KeysCollection/System.Collections.ICollection.IsSynchronized/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/Overview/remarks.cs |
Modernizes and renames the synchronization sample. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/Overview/Project.csproj |
Adds an executable project. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/Overview/Program.cs |
Runs both overview samples. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/Overview/nameobjectcollectionbase.cs |
Modernizes the primary overview sample. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/IsReadOnly/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/IsReadOnly/nocb_isreadonly.cs |
Modernizes the read-only sample. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseSet/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseSet/nocb_baseset.cs |
Modernizes the BaseSet sample. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseRemove/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseRemove/nocb_baseremove.cs |
Modernizes the removal sample. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseHasKeys/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseHasKeys/nocb_basehaskeys.cs |
Modernizes the key-checking sample. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseGetKey/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseGetKey/nocb_baseget.cs |
Modernizes the key retrieval sample. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseGetAllKeys/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseGetAllKeys/nocb_basegetall.cs |
Modernizes key and value retrieval. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseClear/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseClear/nocb_baseclear.cs |
Modernizes the clearing sample. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseAdd/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/NameObjectCollectionBase/BaseAdd/nocb_baseadd.cs |
Modernizes the addition sample. |
snippets/csharp/System.Collections.Specialized/ListDictionary/Overview/source2.cs |
Modernizes and renames the synchronization sample. |
snippets/csharp/System.Collections.Specialized/ListDictionary/Overview/Project.csproj |
Adds an executable project. |
snippets/csharp/System.Collections.Specialized/ListDictionary/Overview/Program.cs |
Runs both overview samples. |
snippets/csharp/System.Collections.Specialized/ListDictionary/Overview/listdictionary.cs |
Modernizes the dictionary overview. |
snippets/csharp/System.Collections.Specialized/ListDictionary/Count/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/ListDictionary/Count/listdictionary_enumerator.cs |
Modernizes enumeration examples. |
snippets/csharp/System.Collections.Specialized/ListDictionary/CopyTo/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/ListDictionary/CopyTo/listdictionary_copyto.cs |
Modernizes the copy sample. |
snippets/csharp/System.Collections.Specialized/ListDictionary/Contains/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/ListDictionary/Contains/listdictionary_contains.cs |
Modernizes the lookup sample. |
snippets/csharp/System.Collections.Specialized/ListDictionary/Add/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/ListDictionary/Add/listdictionary_addremove.cs |
Modernizes add/remove operations. |
snippets/csharp/System.Collections.Specialized/IOrderedDictionary/Overview/remarks.cs |
Modernizes the secondary implementation. |
snippets/csharp/System.Collections.Specialized/IOrderedDictionary/Overview/Project.csproj |
Adds an executable project. |
snippets/csharp/System.Collections.Specialized/IOrderedDictionary/Overview/Program.cs |
Runs both implementations. |
snippets/csharp/System.Collections.Specialized/IOrderedDictionary/Overview/iordereddictionary.cs |
Modernizes the primary implementation. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/Overview/source2.cs |
Modernizes the secondary sample. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/Overview/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/Overview/Program.cs |
Runs both overview samples. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/Overview/hybriddictionary.cs |
Modernizes the dictionary overview. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/Count/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/Count/hybriddictionary_enumerator.cs |
Modernizes enumeration examples. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/CopyTo/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/CopyTo/hybriddictionary_copyto.cs |
Modernizes the copy sample. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/Contains/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/Contains/hybriddictionary_contains.cs |
Modernizes the lookup sample. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/Add/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/HybridDictionary/Add/hybriddictionary_addremove.cs |
Modernizes add/remove operations. |
snippets/csharp/System.Collections.Specialized/CollectionsUtil/Overview/source.cs |
Modernizes output formatting. |
snippets/csharp/System.Collections.Specialized/CollectionsUtil/Overview/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/BitVector32+Section/Overview/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/BitVector32+Section/Overview/bitvector32_sections.cs |
Modernizes the section sample. |
snippets/csharp/System.Collections.Specialized/BitVector32/Overview/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/BitVector32/Overview/bitvector32_bitflags.cs |
Modernizes the bit-flag sample. |
snippets/csharp/System.Collections.Specialized/BitVector32/Equals/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/BitVector32/Equals/bitvector32_equals.cs |
Modernizes comparison examples. |
snippets/csharp/System.Collections.Specialized/BitVector32/CreateMask/Project.csproj |
Makes the project executable. |
snippets/csharp/System.Collections.Specialized/BitVector32/CreateMask/bitvector32_createmasks.cs |
Modernizes mask creation. |
Suppressed comments (1)
snippets/csharp/System.Collections.Specialized/IOrderedDictionary/Overview/remarks.cs:136
ArrayList(int)reserves capacity but doesn't create elements. BecauseValueCollectionis still empty, assigningValueCollection[i]throwsArgumentOutOfRangeExceptionfor every nonemptySimpleOD; populate it withAddinstead.
ArrayList ValueCollection = new(itemlist.Count);
💡 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 18:25
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.