Why is the following code snippet valid in C#? This is a feature of the compiler or a bug?
class A
{
public class B : A
{
}
}
class C : A.B
{
public void Foo(C.B b)
{
}
}
class D : A
{
public void Foo(D.B.B.B.B b)
{
}
}
It's legal code, but quirky. I can dig out the bit in the spec about name resolution if you want - but it's definitely legal. I've had a conversation about a similar topic with Eric Lippert before. Strangely enough, that used D.B.B.B.B... too.
The conversation came up due to this earlier question.
The relevant section of the C# 3.0 spec is 3.8, but it's too long and involved to be worth posting here.