UsingSystem;
ClassTestapp
{
// Define a new class called 'system' to cause
Problems.
Public ClassSystem {}
// Define a constant called 'console' to cause more
Problems.
Const IntConsole = 7;
Const IntNumber =
66;
Static VoidMain ()
{
// Error accesses testapp. Console
// Console. writeline (number );
}
}
BecauseTestapp. SystemHidden
SystemNamespace, so use
System. ConsoleIt will still cause errors:
// Error accesses
Testapp. System
System. Console. writeline (number );
However, you can useGlobal: system. Console
Avoid this error as follows:
Global: system. Console. writeline (number );
Obviously, it is not recommended to create your own nameSystem
You cannot encounter anyCode. However, in a large project, there may be repeated namespaces in one form or other forms. In this case, the global namespace qualifier ensures that you can specify the root namespace.
Global is C #2.0.
In theory, if the code is well written, it is not required at all.
Suppose you have written a class named system. Then, when you write System in the code
The compiler does not know whether you are writing the system class or the system namespace.
The namespace is already the root namespace and cannot be specified by a full name restriction. In the previous C # version, this is an unsolved problem. Now, you can use
Global: SystemTo indicate System
Root namespace,
And use your ownMynamespace. System
To represent your own class.
Of course, this should not happen. You should not write a class named system.
From: http://www.cnblogs.com/distance/archive/2011/04/20/2022202.html