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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:36:42+00:00 2026-06-06T10:36:42+00:00

I have an internal class A that does a lot of stuff and I

  • 0

I have an internal class A that does a lot of stuff and I have a set of other classes B, D, E that inherit from class A. Of course this won’t work as the compiler will complain about a public class not being able to extend an internal one (see this for an explanation).

I don’t want A to be public as I don’t want my users to inherit from it. I want them to only use B, D, E.

I know I can hide the class from Intellisense using [EditorBrowsable(EditorBrowsableState.Never)] but the users can still access it using reflection 🙁

Is there a way I can achieve this?

  • 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-06T10:36:43+00:00Added an answer on June 6, 2026 at 10:36 am

    Assuming that A is in the assembly A, and B, D and E are in the assembly BDE, you can declare the InternalsVisibleTo attribute on A to make BDE a friend assembly. Like this, B, D and E will be able to see A.

    Still, you cannot inherit from A, as superclasses cannot have a lower visibility than subclasses. You can solve this by declaring A public while making all of its constructors internal. This way, only code with internal access to A will be able to derive from A.

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

Sidebar

Related Questions

So I have a class that looks like this: internal class MyClass { public
I have written a class that will handle internal logging in my application. Now
I have simplified my code to this internal class Program { private static void
I have a class like this internal class Report { public Company TargetCompany {
I have some code that relied on methods not being inlined : internal class
I have a c# static class that I have declared as internal. I also
I am writing a class library that contains classes with purely internal members. I
I have the following class, internal class PageInformation { public string Name { get;
I have a doubt. 1. namespace JIMS.ViewModel.Stock 2. { 3. internal class StockGroupViewModel :
I have the following code: namespace ConectorV2 { [assembly:InternalsVisibleTo(Pruebas)] internal static class Utilidades {

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.