Modernize C# code snippets (more System.ComponentModel) - #13019
Merged
gewarren merged 4 commits intoAug 24, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Modernizes System.ComponentModel C# snippets while preserving their documented APIs and adds build coverage for previously unprojected samples.
Changes:
- Applies modern C# syntax, formatting, naming, and string interpolation.
- Cleans up comments, imports, and redundant code.
- Adds two .NET 10 Windows Forms snippet projects.
Reviewed changes
Copilot reviewed 68 out of 71 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
snippets/csharp/System.ComponentModel/Win32Exception/Overview/win32exception.cs |
Simplifies value output. |
snippets/csharp/System.ComponentModel/TypeDescriptor/GetProperties/Form1.cs |
Uses string interpolation. |
snippets/csharp/System.ComponentModel/TypeConverterAttribute/Overview/source.cs |
Modernizes output formatting. |
snippets/csharp/System.ComponentModel/TypeConverter/Overview/source.cs |
Reformats enum declaration. |
snippets/csharp/System.ComponentModel/ToolboxItemFilterAttribute/Overview/samplecontrol.cs |
Modernizes construction and formatting. |
snippets/csharp/System.ComponentModel/ToolboxItemAttribute/Overview/Form1.cs |
Modernizes Windows Forms initialization. |
snippets/csharp/System.ComponentModel/RefreshEventHandler/Overview/refreshevent.cs |
Cleans comments and output. |
snippets/csharp/System.ComponentModel/ReadOnlyAttribute/Overview/source.cs |
Corrects indentation. |
snippets/csharp/System.ComponentModel/ReadOnlyAttribute/IsReadOnly/source.cs |
Corrects indentation. |
snippets/csharp/System.ComponentModel/ProvidePropertyAttribute/Overview/source.cs |
Cleans comment formatting. |
snippets/csharp/System.ComponentModel/PropertyTabAttribute/Overview/class1.cs |
Reformats property construction. |
snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/Overview/source.cs |
Corrects comment grammar. |
snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/Item/source1.cs |
Reformats and disambiguates sample type. |
snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/Item/source.cs |
Reformats indexer sample. |
snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/Item/Project.csproj |
Adds .NET 10 project. |
snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/Item/Program.cs |
Adds project entry point. |
snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/GetEnumerator/source.cs |
Simplifies enumeration output. |
snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/Find/source.cs |
Modernizes formatting and grammar. |
snippets/csharp/System.ComponentModel/PropertyDescriptorCollection/Count/source.cs |
Modernizes count output. |
snippets/csharp/System.ComponentModel/PropertyDescriptor/Overview/SerializeReadOnlyPropertyDescriptor.cs |
Cleans comments. |
snippets/csharp/System.ComponentModel/PropertyDescriptor/Overview/propertydescriptor.cs |
Modernizes descriptor output. |
snippets/csharp/System.ComponentModel/LicenseProviderAttribute/Overview/source.cs |
Uses string interpolation. |
snippets/csharp/System.ComponentModel/ISupportInitialize/Overview/form1.cs |
Modernizes initialization and output. |
snippets/csharp/System.ComponentModel/IListSource/Overview/Employee.cs |
Modernizes fields and constructors. |
snippets/csharp/System.ComponentModel/IEditableCollectionViewAddNewItem/Overview/data.cs |
Modernizes formatting and defaults. |
snippets/csharp/System.ComponentModel/IEditableCollectionView/Overview/Window1.xaml.cs |
Modernizes formatting and collection syntax. |
snippets/csharp/System.ComponentModel/EventDescriptorCollection/GetEnumerator/source.cs |
Simplifies enumerator handling. |
snippets/csharp/System.ComponentModel/EventDescriptorCollection/Count/source.cs |
Modernizes count output. |
snippets/csharp/System.ComponentModel/DoWorkEventArgs/Overview/Form1.cs |
Uses string interpolation. |
snippets/csharp/System.ComponentModel/DesignOnlyAttribute/Overview/source.cs |
Modernizes output formatting. |
snippets/csharp/System.ComponentModel/DefaultValueAttribute/Overview/source.cs |
Modernizes output formatting. |
snippets/csharp/System.ComponentModel/CollectionChangeEventArgs/Overview/Project.csproj |
Adds .NET 10 project. |
snippets/csharp/System.ComponentModel/BindingListT/Overview/Form1.cs |
Modernizes construction and handlers. |
snippets/csharp/System.ComponentModel/AttributeCollection/GetEnumerator/source.cs |
Simplifies enumeration logic. |
snippets/csharp/System.ComponentModel/AttributeCollection/Count/source.cs |
Simplifies collection initialization. |
snippets/csharp/System.ComponentModel/AmbientValueAttribute/Overview/form1.cs |
Uses string interpolation. |
snippets/csharp/System.ComponentModel/AmbientValueAttribute/Overview/attributesdemocontrol.cs |
Sorts imports and modernizes formatting. |
snippets/csharp/System.ComponentModel.Design/ServiceCreatorCallback/Overview/source.cs |
Reformats callback sample. |
snippets/csharp/System.ComponentModel.Design/IRootDesigner/Overview/class1.cs |
Modernizes fields and collections. |
snippets/csharp/System.ComponentModel.Design/IResourceService/Overview/source.cs |
Modernizes resource designer syntax. |
snippets/csharp/System.ComponentModel.Design/IExtenderListService/Overview/extenderlistserviceexample.cs |
Modernizes loops and initialization. |
snippets/csharp/System.ComponentModel.Design/IEventBindingService/Overview/source.cs |
Modernizes event-binding logic. |
snippets/csharp/System.ComponentModel.Design/IDesigner/Overview/testcontrol.cs |
Simplifies designer implementation. |
snippets/csharp/System.ComponentModel.Design/DesignerVerbCollection/Overview/class1.cs |
Modernizes collection operations. |
snippets/csharp/System.ComponentModel.Design/DesignerVerb/Overview/component1.cs |
Modernizes verb initialization. |
snippets/csharp/System.ComponentModel.Design/DesignerTransactionCloseEventHandler/Overview/designertransactioncloseeventhandlerexample.cs |
Adds braces and cleans handlers. |
snippets/csharp/System.ComponentModel.Design/DesignerEventHandler/Overview/designereventhandlerexample.cs |
Modernizes handler output. |
snippets/csharp/System.ComponentModel.Design/DesignerCollection/Overview/examplecomponent.cs |
Reformats collection iteration. |
snippets/csharp/System.ComponentModel.Design/DesignerActionHeaderItem/Overview/designeractions.cs |
Simplifies properties and initialization. |
snippets/csharp/System.ComponentModel.Design/ComponentRenameEventHandler/Overview/componentrenameeventhandlerexample.cs |
Modernizes event output. |
snippets/csharp/System.ComponentModel.Design/ComponentEventHandler/Overview/componenteventhandlerexample.cs |
Modernizes event handling. |
snippets/csharp/System.ComponentModel.Design/ComponentDesigner/Overview/examplecomponent.cs |
Simplifies designer API usage. |
snippets/csharp/System.ComponentModel.Design/ComponentChangingEventHandler/Overview/componentchangingeventhandlerexample.cs |
Modernizes event output. |
snippets/csharp/System.ComponentModel.Design/ComponentChangedEventHandler/Overview/componentchangedeventhandlerexample.cs |
Modernizes event output. |
snippets/csharp/System.ComponentModel.Design/ComponentChangedEventArgs/Overview/componentchangedeventargsexample.cs |
Removes unnecessary scaffolding. |
snippets/csharp/System.ComponentModel.Design/ArrayEditor/Overview/class1.cs |
Simplifies the array property. |
snippets/csharp/System.ComponentModel.Design/ActiveDesignerEventHandler/Overview/activedesignereventhandlerexample.cs |
Modernizes event handling. |
snippets/csharp/System.ComponentModel.Design/ActiveDesignerEventArgs/Overview/class1.cs |
Removes unused entry point. |
snippets/csharp/System.ComponentModel.Design.Serialization/ResolveNameEventHandler/Overview/form1.cs |
Modernizes serialization events. |
snippets/csharp/System.ComponentModel.Design.Serialization/ResolveNameEventArgs/Overview/class1.cs |
Cleans signatures and formatting. |
snippets/csharp/System.ComponentModel.Design.Serialization/INameCreationService/Overview/class1.cs |
Modernizes identifier creation. |
snippets/csharp/System.ComponentModel.Design.Serialization/DesignerSerializerAttribute/Overview/source.cs |
Simplifies serializer sample. |
snippets/csharp/System.ComponentModel.Design.Serialization/ContextStack/Overview/class1.cs |
Modernizes stack operations. |
snippets/csharp/System.ComponentModel.Design.Serialization/CodeDomSerializerException/Overview/source.cs |
Removes unused imports and whitespace. |
snippets/csharp/System.ComponentModel.Design.Serialization/CodeDomSerializer/Overview/idesignerserializationmanagersample.cs |
Reformats serializer lookup. |
snippets/csharp/System.ComponentModel.Composition/ExportAttribute/program.cs |
Converts data fields to properties. |
snippets/csharp/System.ComponentModel.Composition.Hosting/DirectoryCatalog/consoleapplication7/program.cs |
Modernizes composition initialization. |
snippets/csharp/System.ComponentModel.Composition.Hosting/DirectoryCatalog/classlibrary1/class1.cs |
Cleans imports and exported data. |
snippets/csharp/System.ComponentModel.Composition.Hosting/CompositionContainer/Overview/program.cs |
Modernizes container setup. |
snippets/csharp/System.ComponentModel.Composition.Hosting/CompositionContainer/Compose/program.cs |
Modernizes composition batch setup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
gewarren
marked this pull request as ready for review
August 24, 2026 15:43
adegeo
approved these changes
Aug 24, 2026
adegeo
approved these changes
Aug 24, 2026
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.