Skip to content

Conversation

@BillWagner
Copy link
Member

@BillWagner BillWagner commented Dec 15, 2025

The `file` modifier isn't classified as an access modifier. It's a modifier that can't be combined with any other access modifier, and can only be applied to top-level types.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR clarifies that the file modifier is not an access modifier, but rather a distinct type of modifier in C#. The documentation is updated across multiple files to reflect this important distinction by separating the description of file from the list of access modifiers.

Key Changes

  • Reduces the count of access modifiers from 5 to 4 (removing file from the list)
  • Reduces accessibility levels from 7 to 6
  • Adds separate sections explaining that file is a distinct modifier that cannot be combined with access modifiers
  • Removes the "(except file)" qualifier from the Main method documentation since file was never an access modifier
  • Improves writing style throughout by converting to active voice and sentence case headings

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
docs/csharp/programming-guide/classes-and-structs/access-modifiers.md Separates file modifier documentation from access modifiers list, adds clarification that file cannot be combined with access modifiers, and applies sentence case to heading
docs/csharp/language-reference/keywords/accessibility-levels.md Adds new section explaining file modifier separately from access modifiers table, updates heading to sentence case, and improves writing style
docs/csharp/language-reference/keywords/access-modifiers.md Updates access modifier count from 5 to 4, changes accessibility level count from 7 to 6, and adds separate explanation of file modifier with note that it cannot be combined with access modifiers
docs/csharp/fundamentals/program-structure/main-command-line.md Removes "(except file)" qualifier from Main method documentation since file is not an access modifier, and applies various writing style improvements

@BillWagner BillWagner requested a review from gewarren December 15, 2025 22:10
@BillWagner BillWagner enabled auto-merge (squash) December 16, 2025 14:56
@BillWagner BillWagner merged commit 4fafcf7 into dotnet:main Dec 16, 2025
9 checks passed
@BillWagner BillWagner deleted the file-modifier branch December 16, 2025 15:12
Remember to save this program as *MainReturnValTest.cs*.

When a program is executed in Windows, any value returned from the `Main` function is stored in an environment variable. This environment variable can be retrieved using `ERRORLEVEL` from a batch file, or `$LastExitCode` from PowerShell.
When you execute a program in Windows, the system stores any value returned from the `Main` function in an environment variable. You can retrieve this environment variable by using `ERRORLEVEL` from a batch file, or `$LastExitCode` from PowerShell.

Choose a reason for hiding this comment

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

I'm pretty sure the system doesn't store the return value in an environment variable (of which process would that be?). It's the shell which retrieves the exit code, and stores it in an internal variable (neither ERRORLEVEL nor LastExitCode are environment variables).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File modifier is not an accessibility modifier

3 participants