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 8280777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:48:13+00:00 2026-06-08T09:48:13+00:00

I’m using C# 4. The comments explain the purpose of the classes and why

  • 0

I’m using C# 4.

The comments explain the purpose of the classes and why they’re structured the way they are.

/// <summary>
/// I want this internal just to reduce the number of publicly
/// accessible classes in this assembly.  I don't want people to
/// come after me to even spend time reading about this class,
/// since it won't help them unless they're modifying, and not
/// using this assembly.
/// </summary>
internal class MyInternalClass
{
}

/// <summary>
/// This class is an initialization class for tests.  This is the
/// base class for other initialization classes so that I can have 
/// a tree-like structure of method calls.  This needs to be
/// public because it is the base class of a derived class that needs
/// to be public.
/// </summary>
public class MyPublicClass
{
    protected internal MyInternalClass MyInternalProperty;
}

/// <summary>
/// This class is a test class that tests a particular initialization
/// class.  This class needst to be public, else the Unit Testing 
/// framework will not execute its methods.
/// </summary>
public class MyInheritedPublicClass : MyPublicClass
{
}

Can anyone tell me why I’m getting an inconsistent visibility error for the above code?

As I understand here are the meanings of the visibility modifiers in C#:

public: Everyone, everywhere can see and access this without any sort of reflection hacks.

private: This is only accessible within the scope of the class it’s declared in. Derived classes and other classes in the same namespace and assembly cannot see this.

protected: This is only accessible within the scope of the class it’s declared in and any derived classes, regardless of the assembly or namespace, provided the class is public. If the class is internal then of course that will further limit the classes that can see this property.

internal: This is only accessible to entities within the same assembly.

I thought a protected internal modifier would act like the intersection of protected and internal in a venn-diagram — it would only be accessible to entities that were in the same assembly and were a subclass of said class where the property/method/constructor/field/whatever exists. Given my beliefs, I thought the preceding code should compile.

  • 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-06-08T09:48:15+00:00Added an answer on June 8, 2026 at 9:48 am

    protected internal is not an intersection of protected and internal, it is an union, which means that protected internal property will be visible to all descendants of class irregardless of which assembly they are in.

    Reference: http://msdn.microsoft.com/en-us/library/ms173121.aspx

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the

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.