[global::]是什么形式?[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 10:24:04
[global::]是什么形式?[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

[global::]是什么形式?[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::]是什么形式?
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

[global::]是什么形式?[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
命名空间标识符
它代表当前程序集命名空间的最顶层
举个例子:
如果我们自己的代码里写了一个Console类
public class Console{}
那当我们调用Console.WriteLine()的时候就出问题了
按照平常的处理方法会用System.Console.WriteLine()对吧
可是如果我们自己另外还定义了一个System类呢
public class System{}
那这样的话System.Console.WriteLine()也不行了……
所以为了解决这种情况可以使用global::System.Console.WriteLine();
global后面的实际上就是从最顶层开始向下的命名空间路径
这样可以精确地定位需要访问的类