Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File scoped namespaces #1700

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AndrewKeepCoding
Copy link
Contributor

Description

This PR will switch C# files from block-scoped namespaces to file-scoped namespaces.
Closes #1689.

Motivation and Context

Improves readability.

How Has This Been Tested?

  • Confirmed that all unit tests passes.
  • Run the app and navigated through all pages.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@ghost1372
Copy link
Contributor

FYI @AndrewKeepCoding
Do we need all these commits? Use Visual Studio tools!
Animation

@AndrewKeepCoding
Copy link
Contributor Author

AndrewKeepCoding commented Dec 13, 2024

I did. 🙂
However, I also reviewed all the files to check the changes, which is why there are separate commits. I've seen some cases that VS (or VS Code) doesn't apply this kind of changes correctly.

@@ -90,6 +90,9 @@ csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
# IDE0016: Null check can be simplified
csharp_style_throw_expression = true:suggestion

# IDE0161: Convert to file-scoped namespace
csharp_style_namespace_declarations = file_scoped:warning
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this needs to be a warning? I don't see any danger in one or the other form.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm following the way taken by CommunityToolkit Gallery and AI Dev Gallery. It's better this way to keep consistency.

@Marv51
Copy link
Contributor

Marv51 commented Dec 14, 2024

Are you planning to add a .git-blame-ignore-revs file for this PR?

@AndrewKeepCoding
Copy link
Contributor Author

AndrewKeepCoding commented Dec 16, 2024

@Marv51 You are right. Thanks.
TODO: Update the target commit id at the .git-blame-ignore-revs file.

@niels9001 niels9001 requested a review from karkarl December 18, 2024 21:46
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.

Switch to file-scoped namespace
4 participants