-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Clarify that the file modifier isn't an access modifier, it's a different type of modifier.
#50589
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
Conversation
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.
There was a problem hiding this 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
filefrom the list) - Reduces accessibility levels from 7 to 6
- Adds separate sections explaining that
fileis a distinct modifier that cannot be combined with access modifiers - Removes the "(except
file)" qualifier from theMainmethod documentation sincefilewas 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 |
docs/csharp/fundamentals/program-structure/main-command-line.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/keywords/accessibility-levels.md
Outdated
Show resolved
Hide resolved
docs/csharp/language-reference/keywords/accessibility-levels.md
Outdated
Show resolved
Hide resolved
docs/csharp/programming-guide/classes-and-structs/access-modifiers.md
Outdated
Show resolved
Hide resolved
docs/csharp/fundamentals/program-structure/main-command-line.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
docs/csharp/fundamentals/program-structure/main-command-line.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Genevieve Warren <[email protected]>
| 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. |
There was a problem hiding this comment.
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).
Fixes #48224
Find all references to the
filemodifier, and remove or update any where thefilemodifier is referred to as an access modifier. It's classified differently to limit where it can be used, and how it can be applied.Internal previews