Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7180785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:25:17+00:00 2026-05-28T17:25:17+00:00

protected internal: The union of protected and internal accessibility (this is less restrictive than

  • 0

protected internal:

The union of protected and internal accessibility (this is less restrictive than protected or internal alone)

The CLR has the concept of intersection of protected and internal accessibility, but C# does not support this.

So my question is:

What’s the meaning of omitting this Access Modifier, is there a concrete reason? So why C# should not support it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:25:18+00:00Added an answer on May 28, 2026 at 5:25 pm

    Update: C#7.2 is introducing this with the access modifier private protected, which seems wrong in a few ways but does avoid much of the potential for confusion I describe below, so is perhaps the best of a bad bunch.

    Personally, I’ve wanted this quite a few times. There are times when one exposes a class and one or more classes derived from it as public in an assembly, and there are times when some member of the base class is only used by those derived classes and should not be exposed to protected classes in other assemblies (quite often the constructor, so as to prevent other assemblies from having classes that derive from it at all).

    It is of course always good to define your access as restrictively as possible, and so the intersection of protected and internal is precisely what is wanted here.

    Instead, I’ve had to kludge it by declaring the member internal. There is now a potential for bugs in my code that wouldn’t have been there if I used a language that allowed me to use that intersection.

    However, consider the downside.

    As it is, there’s some confusion about the way that protected internal gives the union of protected and internal. It’s probably the most misunderstood access, judged by questions on sites like this.

    What should we call it? internal protected? Can you imagine how often people would get that confused with protected internal? We’d want something more clearly differentiated, and we’d want the same for internal protected (because we’ve still increased its potential for confusion). It’s not an impossible problem to answer, but keeping the number of keywords down is a good idea too.

    Even if a perfect answer is found to the naming question, the potential for confusion by introducing yet another level of access is not entirely defeated.

    So with that in mind, let’s look at the upside again. We no longer have to kludge the times we need it by using internal, reducing bugs caused by inappropriately using such a member. Okay, how often does that come up, and how likely would such bugs actually be? Not very often really, and not very likely.

    On balance therefore, while I do find myself occassionally wishing C# had this, a moment’s pause normally makes me glad they did not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Protected Means, we can access this member only in a deriving class, and internal
I'd like to create an internal auto-property: internal bool IP { get; protected internal
As you may already know, the .NET Framework's protected internal access modifier works in
I have a login-protected website. It's an internal application and it's not avaiable to
protected override Boolean IsValid(String propertyValue) { return !String.IsNullOrEmpty(propertyValue) && propertyValue.Trim().Length > 0; } This
If I have a class with a method I want protected and internal .
i am new to C# and reading this protected : Only derived types or
Possible Duplicate: How to make protected AND internal? i.e. it is an internal member,
I have a password protected internal maven repository I'd like to use to resolve
This property in a type with no access modifier (thus internal access): class SomeType

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.