cannot make publicly visible class from internal class?

I have an internal class:

internal abstract class Reader
{
    //internal abstract void methods
}

I cannot make this class:

public abstract class CustomFileReader : Reader
{
}

Because it is more visible than the class it inherits from. I want to do this to enforce that you must inherit from a publicly accessible inheritor of the Reader class and not the base class. Is this possible or do I have to expose the base class?

Jon Skeet
people
quotationmark

You can't have an internal class in the inheritance tree of a public class, but you can force users to derive from CustomFileReader instead of Reader, by making the only constructor of Reader internal:

public abstract class Reader
{
    internal Reader()
    {
    }
}

public abstract class CustomFileReader : Reader
{
    // Public and protected constructors here
}

Now anything which tries to inherit directly from Reader outside your assembly will be told that it can't find an accessible base class constructor.

people

See more on this question at Stackoverflow