Given:
namespace Program {
// Cannot inherit from inner class
public class Outer : Outer.Inner {
public class Inner { }
}
class Program {
public static void Main() {
Outer.Inner inner = new Outer();
}
}
}
Why can't outer classes implement inner classes? I could see why this would be illegal in Java because inner classes are actually dependent on the outer instance existing before an inner class can be instantiated. But in C#, inner classes don't have any real dependency on the outer class other than scope (and the rules that come along with it). So why is this illegal? Is it just by convention, or is there some logic to this?