Skip to content

Revise C# Style Guide with new formatting rules - #901

Merged
ChrisPulman merged 1 commit into
mainfrom
glennawatson-patch-1
Sep 5, 2025
Merged

ChrisPulman merged 1 commit into
mainfrom
glennawatson-patch-1

Conversation

@glennawatson

Copy link
Copy Markdown
Contributor

Update C# Style Guide to Incorporate Modern C# Features (C# 8-12)

This commit updates the C# Style Guide to align with modern C# features from versions 8 through 12, enhancing code readability, maintainability, and safety. Key changes include:

  • New Content: Added guidelines for modern C# features, including nullable reference types, ranges/indices, using declarations, switch expressions, records, init-only setters, target-typed new expressions, file-scoped namespaces, raw string literals, required members, primary constructors, collection expressions, and more (items 21–36).
  • Better Readability: Structured new guidelines to be concise and clear, maintaining consistency with existing rules for Allman style, indentation, and naming conventions.
  • Content Correction: Updated references to reflect current Microsoft documentation and best practices, ensuring accuracy for newer C# features.
  • Improved Messaging: Emphasized the use of modern features to reduce boilerplate, enhance immutability, and improve type safety, while maintaining compatibility with existing style preferences.

These changes ensure the style guide remains relevant for current C# development while preserving the original structure and intent. The analyzer ruleset is recommended for updates to enforce new features like nullable reference types.

Update C# Style Guide to Incorporate Modern C# Features (C# 8-12)

This commit updates the C# Style Guide to align with modern C# features from versions 8 through 12, enhancing code readability, maintainability, and safety. Key changes include:

- **New Content**: Added guidelines for modern C# features, including nullable reference types, ranges/indices, using declarations, switch expressions, records, init-only setters, target-typed new expressions, file-scoped namespaces, raw string literals, required members, primary constructors, collection expressions, and more (items 21–36).
- **Better Readability**: Structured new guidelines to be concise and clear, maintaining consistency with existing rules for Allman style, indentation, and naming conventions.
- **Content Correction**: Updated references to reflect current Microsoft documentation and best practices, ensuring accuracy for newer C# features.
- **Improved Messaging**: Emphasized the use of modern features to reduce boilerplate, enhance immutability, and improve type safety, while maintaining compatibility with existing style preferences.

These changes ensure the style guide remains relevant for current C# development while preserving the original structure and intent. The analyzer ruleset is recommended for updates to enforce new features like nullable reference types.
@ChrisPulman
ChrisPulman merged commit bf5870d into main Sep 5, 2025
4 checks passed
@ChrisPulman
ChrisPulman deleted the glennawatson-patch-1 branch September 5, 2025 00:18
@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants