I\'ve got something like this:
namespace n1
{
namespace n2
{
class foo{}
}
}
Section 9.4.2 paragraph 4 in the C# language specification explains this behavior explicitly:
A using-namespace-directive imports the types contained in the given namespace, but specifically does not import nested namespaces.
It even goes on to give an example that is very similar to your own.
namespace N1.N2
{
class A {}
}
namespace N3
{
using N1;
class B: N2.A {} // Error, N2 unknown
}
Of course had you done this:
namespace n1
{
public class Example
{
public static void Main()
{
n2.Foo a; // This is legal.
}
}
}
This would compile because n2 is accessible since it is referenced from within an ancestor namespace block.