Question: I wonder if there is a way to limit who can inherit from a class.

* `internal`: doesn't allow class to be inherited outside the assembly
* `sealed`: class cannot be inherited

Is there a keyword or way to allow only certain classes (let's say from it's own namespace only) to inherit that class?

Also, I do not want this special class to be generic.
My concern isn't security but the design in general.

Example of what I want:

* Class A.
* Class B inherits from A
* Class C cannot inherit from A

Answer: 
As far as I know, using `internal` is the only way to control who can inherit a class. If the inheritors must be in a different assembly, you can let classes from another assembly see internals of your assembly using [`InternalsVisibleTo`](http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx) attribute (the target assembly must be signed in order for this to work with signed assemblies).
A trick that is sometimes used is declaring private constructors. That way you can achieve:

```
public class A
{
     private A(){}

     // Here B can inherit from A
     public class B : A{}

 }

 // This is not allowed
 public class C : A{}

```

This comes with it's limitations because only classes declared inside of A can inherit from A. I find this trick very useful to do case distinctions.