Global keyword in C,
The global keyword is the literal meaning, global.
In fact, sometimes you may make some mistakes, that is, the class name is the same as the system class name. In fact, this is a design mistake, but there may be a situation where it is not changed, then the global keyword plays a role.
The following code:
1 using System;
2 using System. Collections. Generic;
3 using System. Linq;
4 using System. Text;
5
6 namespace globalFunc
7 {
8 class Program
9 {
10 static void Main (string [] args)
11 {
12 System sys = new System ();
13 global: System. Console. WriteLine ("global .");
14 global: System. Console. ReadKey ();
15}
16}
17 public class System {}
18}
Although using has a System namespace, there is also a public class System {...} in this case, if you directly use System. console. writeLine reports an error because the nearest System class is found, so there is no Console in this System class. Therefore, if you need to use global: System. console. writeLine, because the class marked with global will start to look for globally, and my understanding is that it will gradually look for the System class from the outermost surface.