I was trying to get some of the old code properly styled with stylecop. It asks for putting the using statements inside. It worked
well for all but one. I have reduced the problem to the below code.
namespace B.C
{
using System;
public class Hidden
{
public void SayHello()
{
Console.WriteLine("Hello");
}
}
}
namespace A.B.C
{
using B.C;
public class Program
{
static void Main(string[] args)
{
new Hidden().SayHello();
}
}
}
this gives compilation error Error
“The type or namespace name ‘Hidden’ could not be found (are you missing a using directive or an assembly reference?)”.
If I move using B.C; above the namespace A.B.C then it builds properly. The class Hidden is developed by different team and we cannot modify it.
As you are inside the namespace
A, thenB.Cwill actually beA.B.C.Use
global::to specify that you are looking from the root: