Skip to content

Modernize C# snippets - #13052

Open
gewarren wants to merge 2 commits into
dotnet:mainfrom
gewarren:modernize-system-drawing
Open

Modernize C# snippets#13052
gewarren wants to merge 2 commits into
dotnet:mainfrom
gewarren:modernize-system-drawing

Conversation

@gewarren

@gewarren gewarren commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Contributes to #12713


Internal previews

Toggle expand/collapse
File Preview link
snippets/csharp/System.Drawing/Bitmap/.ctor/form1.cs Learn preview
snippets/csharp/System.Drawing/Bitmap/.ctor/form11.cs Learn preview
snippets/csharp/System.Drawing/Bitmap/.ctor/form12.cs Learn preview
snippets/csharp/System.Drawing/Bitmap/Clone/form1.cs Learn preview
snippets/csharp/System.Drawing/Bitmap/Overview/form1.cs Learn preview
snippets/csharp/System.Drawing/Bitmap/SetResolution/Form1.cs Learn preview
snippets/csharp/System.Drawing/Brushes/Overview/form1.cs Learn preview
snippets/csharp/System.Drawing/BufferedGraphics/Overview/bufferingtest.cs Learn preview
snippets/csharp/System.Drawing/BufferedGraphics/Render/bufferingexamples.cs Learn preview
snippets/csharp/System.Drawing/CharacterRange/Equals/Form1.cs Learn preview
snippets/csharp/System.Drawing/CharacterRange/Overview/form1.cs Learn preview
snippets/csharp/System.Drawing/Color/FromArgb/form1.cs Learn preview
snippets/csharp/System.Drawing/Color/Name/form1.cs Learn preview
snippets/csharp/System.Drawing/Color/Overview/form1.cs Learn preview
snippets/csharp/System.Drawing/ColorConverter/Overview/form1.cs Learn preview
snippets/csharp/System.Drawing/ColorTranslator/FromHtml/form1.cs Learn preview
snippets/csharp/System.Drawing/Font/Clone/form1.cs Learn preview
snippets/csharp/System.Drawing/Font/Overview/form1.cs Learn preview
snippets/csharp/System.Drawing/FontFamily/Equals/form1.cs Learn preview
snippets/csharp/System.Drawing/Graphics/Clip/form1.cs Learn preview
snippets/csharp/System.Drawing/Graphics/CopyFromScreen/Form1.cs Learn preview
snippets/csharp/System.Drawing/Graphics/DrawImage/form1.cs Learn preview
snippets/csharp/System.Drawing/Graphics/EnumerateMetafile/Form1.cs Learn preview
snippets/csharp/System.Drawing/Graphics/FillRectangle/form1.cs Learn preview
snippets/csharp/System.Drawing/Graphics/Overview/form1.cs Learn preview
snippets/csharp/System.Drawing/Graphics/SmoothingMode/form1.cs Learn preview
snippets/csharp/System.Drawing/Image/Save/form1.cs Learn preview
snippets/csharp/System.Drawing/ImageAnimator/Animate/form1.cs Learn preview
snippets/csharp/System.Drawing/Pen/Clone/form1.cs Learn preview
snippets/csharp/System.Drawing/Rectangle/Inflate/form1.cs Learn preview
snippets/csharp/System.Drawing/Rectangle/Overview/Class1.cs Learn preview
snippets/csharp/System.Drawing/RectangleF/Inflate/form1.cs Learn preview
snippets/csharp/System.Drawing/Region/Complement/form1.cs Learn preview
snippets/csharp/System.Drawing/StringFormat/GetTabStops/form1.cs Learn preview
snippets/csharp/System.Drawing/TextureBrush/Clone/form1.cs Learn preview
snippets/csharp/System.Drawing/ToolboxBitmapAttribute/Overview/usercontrol1.cs Learn preview

Build report

Copilot AI left a comment

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.

🟢 Approval recommended

The modernization preserves sample behavior, with only two non-blocking spelling corrections identified.

Pull request overview

Modernizes System.Drawing C# snippets for .NET 10 while preserving their documented APIs.

Changes:

  • Normalizes formatting and adopts modern C# syntax.
  • Consolidates Bitmap constructor samples into one executable project.
  • Renames duplicate form types and entry points.
File summaries
File Description
ToolboxBitmapAttribute/Overview/usercontrol1.cs Modernizes formatting and member access.
TextureBrush/Clone/form1.cs Normalizes WinForms sample formatting.
StringFormat/GetTabStops/form1.cs Adds collection expressions and formatting.
Region/Complement/form1.cs Normalizes formatting and disposal logic.
RectangleF/Inflate/form1.cs Modernizes WinForms scaffolding.
Rectangle/Overview/Class1.cs Uses collection and object initializers.
Rectangle/Inflate/form1.cs Modernizes WinForms scaffolding.
Pen/Clone/form1.cs Uses object initializers and cleaner member access.
ImageAnimator/Animate/form1.cs Simplifies event and member access.
Image/Save/form1.cs Uses built-in aliases and normalized spacing.
Graphics/SmoothingMode/form1.cs Uses object and collection initializers.
Graphics/FillRectangle/form1.cs Modernizes arrays, initializers, and member access.
Graphics/EnumerateMetafile/Form1.cs Sorts imports and normalizes formatting.
Graphics/CopyFromScreen/Form1.cs Simplifies member access and type aliases.
Graphics/Clip/form1.cs Normalizes WinForms and drawing code.
FontFamily/Equals/form1.cs Repairs formatting and snippet structure.
Font/Overview/form1.cs Modernizes WinForms initialization and handlers.
Font/Clone/form1.cs Normalizes formatting and built-in types.
ColorTranslator/FromHtml/form1.cs Modernizes WinForms scaffolding and spacing.
ColorConverter/Overview/form1.cs Simplifies casts and member access.
Color/Overview/form1.cs Modernizes controls and formatting calls.
Color/Name/form1.cs Uses object and collection initializers.
Color/FromArgb/form1.cs Normalizes arithmetic and declaration formatting.
CharacterRange/Overview/form1.cs Modernizes arrays, events, and member access.
CharacterRange/Equals/Form1.cs Normalizes spacing and member access.
BufferedGraphics/Render/bufferingexamples.cs Cleans buffer API formatting.
BufferedGraphics/Overview/bufferingtest.cs Modernizes buffering sample syntax.
Brushes/Overview/form1.cs Normalizes WinForms and rectangle examples.
Bitmap/SetResolution/Form1.cs Modernizes arrays and reorganizes snippets.
Bitmap/Overview/form1.cs Modernizes controls, handlers, and initializers.
Bitmap/Clone/form1.cs Simplifies disposal and member access.
Bitmap/.ctor/Project.csproj Adds the consolidated .NET 10 WinForms project.
Bitmap/.ctor/Program.cs Adds the shared executable entry point.
Bitmap/.ctor/form12.cs Renames the form and converts Main to Run.
Bitmap/.ctor/form11.cs Renames the form and converts Main to Run.
Bitmap/.ctor/form1.cs Renames the form and converts Main to Run.
Review details

Suppressed comments (1)

snippets/csharp/System.Drawing/BufferedGraphics/Overview/bufferingtest.cs:79

  • Correct the typo in this explanatory comment.
                // enabke the control style.
  • Files reviewed: 38/38 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread snippets/csharp/System.Drawing/BufferedGraphics/Overview/bufferingtest.cs Outdated
@gewarren
gewarren marked this pull request as ready for review September 2, 2026 18:59
@gewarren
gewarren requested a review from a team as a code owner September 2, 2026 18:59
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.

2 participants