Skip to content

Modernize C# snippets - System.CodeDom - #12998

Open
gewarren wants to merge 3 commits into
dotnet:mainfrom
gewarren:modernize-system-codedeom
Open

Modernize C# snippets - System.CodeDom#12998
gewarren wants to merge 3 commits into
dotnet:mainfrom
gewarren:modernize-system-codedeom

Conversation

@gewarren

@gewarren gewarren commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Contributes to #12713


Internal previews

Toggle expand/collapse
File Preview link
snippets/csharp/System.CodeDom/CodeArgumentReferenceExpression/Overview/codeargumentreferenceexpressionexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeArrayCreateExpression/Overview/codearraycreateexpressionsnippet.cs Preview published page
snippets/csharp/System.CodeDom/CodeAttachEventStatement/Overview/codeattacheventstatementexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeAttributeArgument/Overview/source.cs Preview published page
snippets/csharp/System.CodeDom/CodeAttributeArgumentCollection/Overview/class1.cs Preview published page
snippets/csharp/System.CodeDom/CodeAttributeDeclaration/Overview/source.cs Preview published page
snippets/csharp/System.CodeDom/CodeAttributeDeclarationCollection/Overview/class1.cs Preview published page
snippets/csharp/System.CodeDom/CodeBaseReferenceExpression/Overview/codebasereferenceexpressionexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeBinaryOperatorExpression/Overview/codebinaryoperatorexpressionexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeCastExpression/Overview/codecastexpressionexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeCatchClause/Overview/codetrycatchfinallyexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeCatchClauseCollection/Overview/class1.cs Preview published page
snippets/csharp/System.CodeDom/CodeChecksumPragma/Overview/codedirective.cs Preview published page
snippets/csharp/System.CodeDom/CodeComment/Overview/codecommentexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeCommentStatement/.ctor/program.cs Preview published page
snippets/csharp/System.CodeDom/CodeCommentStatementCollection/Overview/class1.cs Preview published page
snippets/csharp/System.CodeDom/CodeConditionStatement/Overview/codeconditionstatementexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeConstructor/Overview/codeconstructorexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeDefaultValueExpression/Overview/codedomgenerics.cs Preview published page
snippets/csharp/System.CodeDom/CodeDelegateInvokeExpression/Overview/codedelegateinvokeexpressionexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeDirectionExpression/Overview/codemultiexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeDirectiveCollection/Overview/class1.cs Preview published page
snippets/csharp/System.CodeDom/CodeEntryPointMethod/Overview/codeentrypointmethodexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeExpressionCollection/Overview/class1.cs Preview published page
snippets/csharp/System.CodeDom/CodeExpressionStatement/Overview/class1.cs Preview published page
snippets/csharp/System.CodeDom/CodeFieldReferenceExpression/Overview/codereferenceexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeGotoStatement/Overview/codegotostatementexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeIterationStatement/Overview/codeiterationstatementexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeMemberEvent/Overview/codemembereventexample.cs Preview published page
snippets/csharp/System.CodeDom/CodeMemberField/InitExpression/program.cs Preview published page

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.

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.

Pull request overview

Modernizes System.CodeDom C# snippets for .NET 10 and current C# syntax.

Changes:

  • Updates formatting, collection expressions, interpolation, aliases, and imports.
  • Adds or updates executable project configurations.
  • Consolidates entry points and normalizes snippet markers.

Reviewed changes

Copilot reviewed 72 out of 75 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
snippets/csharp/System.CodeDom/CodeArgumentReferenceExpression/Overview/codeargumentreferenceexpressionexample.cs Modernizes formatting.
snippets/csharp/System.CodeDom/CodeArrayCreateExpression/Overview/Project.csproj Adds a .NET 10 Windows project.
snippets/csharp/System.CodeDom/CodeArrayCreateExpression/Overview/codearraycreateexpressionsnippet.cs Modernizes WinForms sample syntax.
snippets/csharp/System.CodeDom/CodeArrayIndexerExpression/Overview/Project.csproj Adds a .NET 10 Windows project.
snippets/csharp/System.CodeDom/CodeArrayIndexerExpression/Overview/codearrayindexerexpressionsnippet.cs Modernizes WinForms sample syntax.
snippets/csharp/System.CodeDom/CodeAssignStatement/Overview/Project.csproj Adds a .NET 10 Windows project.
snippets/csharp/System.CodeDom/CodeAssignStatement/Overview/codeassignstatementsnippet.cs Modernizes WinForms sample syntax.
snippets/csharp/System.CodeDom/CodeAttachEventStatement/Overview/codeattacheventstatementexample.cs Normalizes formatting and indentation.
snippets/csharp/System.CodeDom/CodeAttributeArgument/Overview/Project.csproj Configures executable output.
snippets/csharp/System.CodeDom/CodeAttributeArgument/Overview/source.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeAttributeArgumentCollection/Overview/class1.cs Modernizes collection syntax and formatting.
snippets/csharp/System.CodeDom/CodeAttributeDeclaration/Overview/Project.csproj Configures executable output.
snippets/csharp/System.CodeDom/CodeAttributeDeclaration/Overview/source.cs Normalizes the snippet marker.
snippets/csharp/System.CodeDom/CodeAttributeDeclarationCollection/Overview/class1.cs Modernizes collection syntax and formatting.
snippets/csharp/System.CodeDom/CodeBaseReferenceExpression/Overview/codebasereferenceexpressionexample.cs Uses a collection expression.
snippets/csharp/System.CodeDom/CodeBinaryOperatorExpression/Overview/codebinaryoperatorexpressionexample.cs Modernizes formatting.
snippets/csharp/System.CodeDom/CodeCastExpression/Overview/codecastexpressionexample.cs Modernizes formatting.
snippets/csharp/System.CodeDom/CodeCatchClause/Overview/Project.csproj Configures executable output.
snippets/csharp/System.CodeDom/CodeCatchClause/Overview/codetrycatchfinallyexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeCatchClause/Overview/source2.cs Uses collection expressions and interpolation.
snippets/csharp/System.CodeDom/CodeCatchClauseCollection/Overview/class1.cs Modernizes collection syntax and formatting.
snippets/csharp/System.CodeDom/CodeChecksumPragma/Overview/Project.csproj Configures executable output.
snippets/csharp/System.CodeDom/CodeChecksumPragma/Overview/codedirective.cs Modernizes arrays and formatting.
snippets/csharp/System.CodeDom/CodeComment/Overview/codecommentexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeCommentStatement/.ctor/Project.csproj Configures executable output.
snippets/csharp/System.CodeDom/CodeCommentStatement/.ctor/program.cs Consolidates the executable entry point.
snippets/csharp/System.CodeDom/CodeCommentStatement/.ctor/source1.cs Renames an entry point and uses interpolation.
snippets/csharp/System.CodeDom/CodeCommentStatementCollection/Overview/class1.cs Modernizes collection syntax and formatting.
snippets/csharp/System.CodeDom/CodeCompileUnit/Overview/Project.csproj Adds a .NET 10 Windows project.
snippets/csharp/System.CodeDom/CodeCompileUnit/Overview/source.cs Modernizes arrays, aliases, and imports.
snippets/csharp/System.CodeDom/CodeConditionStatement/Overview/codeconditionstatementexample.cs Uses collection expressions and fixes indentation.
snippets/csharp/System.CodeDom/CodeConstructor/Overview/codeconstructorexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeDefaultValueExpression/Overview/Project.csproj Configures executable output.
snippets/csharp/System.CodeDom/CodeDefaultValueExpression/Overview/codedomgenerics.cs Modernizes arrays, imports, and markers.
snippets/csharp/System.CodeDom/CodeDelegateInvokeExpression/Overview/codedelegateinvokeexpressionexample.cs Modernizes arrays and invocation formatting.
snippets/csharp/System.CodeDom/CodeDirectionExpression/Overview/codemultiexample.cs Uses collection expressions and modern formatting.
snippets/csharp/System.CodeDom/CodeDirectiveCollection/Overview/class1.cs Removes an unused import.
snippets/csharp/System.CodeDom/CodeEntryPointMethod/Overview/codeentrypointmethodexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeExpressionCollection/Overview/class1.cs Modernizes collection syntax and indentation.
snippets/csharp/System.CodeDom/CodeExpressionStatement/Overview/class1.cs Modernizes formatting and whitespace.
snippets/csharp/System.CodeDom/CodeFieldReferenceExpression/Overview/codereferenceexample.cs Removes an unused import.
snippets/csharp/System.CodeDom/CodeGotoStatement/Overview/codegotostatementexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeIterationStatement/Overview/codeiterationstatementexample.cs Modernizes nested invocation formatting.
snippets/csharp/System.CodeDom/CodeMemberEvent/Overview/codemembereventexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeMemberField/InitExpression/Project.csproj Configures executable output.
snippets/csharp/System.CodeDom/CodeMemberField/InitExpression/program.cs Cleans imports and snippet markers.
snippets/csharp/System.CodeDom/CodeMemberField/Overview/class1.cs Normalizes indentation and formatting.
snippets/csharp/System.CodeDom/CodeMemberField/Overview/codememberfieldexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeMemberMethod/Overview/codemembermethodexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeMemberProperty/Overview/codememberpropertyexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeMethodInvokeExpression/Overview/codemethodinvokeexpressionexample.cs Uses a collection expression.
snippets/csharp/System.CodeDom/CodeMethodReferenceExpression/.ctor/Project.csproj Configures executable output.
snippets/csharp/System.CodeDom/CodeMethodReferenceExpression/.ctor/source.cs Uses a collection expression and modern formatting.
snippets/csharp/System.CodeDom/CodeMethodReferenceExpression/Overview/codemethodreferenceexample.cs Uses collection expressions and modern formatting.
snippets/csharp/System.CodeDom/CodeNamespace/Overview/codenamespaceexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeNamespaceCollection/Overview/class1.cs Modernizes collection syntax and indentation.
snippets/csharp/System.CodeDom/CodeNamespaceImport/Overview/codenamespaceimportexample.cs Removes an unused import.
snippets/csharp/System.CodeDom/CodeParameterDeclarationExpression/Overview/codeparameterdeclarationexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeParameterDeclarationExpressionCollection/Overview/class1.cs Modernizes collection syntax and indentation.
snippets/csharp/System.CodeDom/CodePrimitiveExpression/Overview/codeprimitiveexpressionexample.cs Removes an unused import.
snippets/csharp/System.CodeDom/CodePropertySetValueReferenceExpression/Overview/codepropertysetvalueexample.cs Modernizes nested invocation formatting.
snippets/csharp/System.CodeDom/CodeRemoveEventStatement/Overview/coderemoveeventexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeStatementCollection/Overview/class1.cs Modernizes collection invocation formatting.
snippets/csharp/System.CodeDom/CodeThrowExceptionStatement/Overview/codethrowexceptionstatementexample.cs Uses a collection expression.
snippets/csharp/System.CodeDom/CodeTypeConstructor/Overview/codetypeconstructorexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeTypeDeclaration/IsPartial/Project.csproj Configures executable output.
snippets/csharp/System.CodeDom/CodeTypeDeclaration/IsPartial/source.cs Uses aliases and interpolation.
snippets/csharp/System.CodeDom/CodeTypeDeclaration/Overview/codetypedeclarationexample.cs Cleans imports and formatting.
snippets/csharp/System.CodeDom/CodeTypeDeclarationCollection/Overview/class1.cs Modernizes collection syntax and indentation.
snippets/csharp/System.CodeDom/CodeTypeDelegate/Overview/codetypedelegateexample.cs Modernizes invocation formatting.
snippets/csharp/System.CodeDom/CodeTypeMemberCollection/Overview/class1.cs Modernizes collection syntax and indentation.
snippets/csharp/System.CodeDom/CodeTypeOfExpression/Overview/Project.csproj Configures executable output.
snippets/csharp/System.CodeDom/CodeTypeOfExpression/Overview/codetypeofexample.cs Normalizes the snippet marker.
snippets/csharp/System.CodeDom/CodeTypeReferenceCollection/Overview/class1.cs Modernizes collection syntax and indentation.
snippets/csharp/System.CodeDom/CodeVariableDeclarationStatement/Overview/codevariabledeclarationstatementexample.cs Cleans imports and formatting.

💡 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.CodeDom/CodeAssignStatement/Overview/Project.csproj Outdated
Comment thread snippets/csharp/System.CodeDom/CodeCompileUnit/Overview/Project.csproj Outdated
Comment thread snippets/csharp/System.CodeDom/CodeArrayIndexerExpression/Overview/Project.csproj Outdated
Comment thread snippets/csharp/System.CodeDom/CodeCompileUnit/Overview/Project.csproj Outdated
@gewarren
gewarren marked this pull request as ready for review August 19, 2026 15:43
@gewarren
gewarren requested a review from a team as a code owner August 19, 2026 15:43
Comment thread snippets/csharp/System.CodeDom/CodeChecksumPragma/Overview/Project.csproj Outdated
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
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.

3 participants