-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Improve clarity of protected access modifier documentation with unified examples and comparison table #47117
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
…ed examples and comparison table Co-authored-by: BillWagner <[email protected]>
BillWagner
left a comment
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.
This is a good start, but I have a few comments.
…mentation Co-authored-by: BillWagner <[email protected]>
BillWagner
left a comment
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.
Good work. One more set of changes.
|
@copilot Can you start working on this again? |
|
@copilot Can you start working on this again? |
|
@copilot Can you start working on this again? |
…d.md Co-authored-by: BillWagner <[email protected]>
BillWagner
left a comment
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.
A few more comments here.
docs/csharp/language-reference/keywords/snippets/protected/protected.csproj
Outdated
Show resolved
Hide resolved
…project file Co-authored-by: BillWagner <[email protected]>
|
The snippets failure is related to a preview feature. |
The documentation for
protected,private protected, andprotected internalaccess modifiers was difficult to compare because examples used different member names, inconsistent structures, and lacked clear explanations of the key differences between these related modifiers.Changes Made
Unified Examples and Naming
myValueas the member name for consistencyAssembly1.cs,Assembly2.cs) across all examplesprotected.mdto use inline examples instead of external code referencesEnhanced Explanations
New Comparison Table
Added a clear comparison table in
private-protected.md:protectedprotected internalprivate protectedUsage Guidelines
Added clear guidance on when to use each modifier:
protectedwhen you want derived classes in any assembly to access the memberprotected internalwhen you want the most permissive accessprivate protectedwhen you want the most restrictive protected accessThese changes make it much easier for developers to understand the differences between these three related access modifiers and choose the appropriate one for their needs.
Fixes #23465.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Internal previews