Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0134

Visual Studio .NET 2003

Cannot use qualified namespace names in nested namespace declarations

A qualified namespace is not permitted in a namespace declaration.

The following sample generates CS0134:

// CS0134.cs
namespace MyNameSpace
{
   namespace MyNameSpace.DottedNamespace   // CS0134, qualified namespace
   // try the following line instead
   // namespace NotRoot
   {
      public class MyClass
      {
         public static void Main()
         {
         }
      }

      namespace DottedNamespace
      {
         public class MyClass2
         {
            public static void f1()
            {
               MyNameSpace.NotRoot.MyClass.Main();   // legal use of qualified namespace
            }
         }
      }
   }
}
Show:
© 2014 Microsoft