:: 运算符(C# 参考):: operator (C# Reference)

命名空间别名限定符(::)用于查找标识符。The namespace alias qualifier (::) is used to look up identifiers. 它始终位于两个标识符之间,如本示例所示:It is always positioned between two identifiers, as in this example:

global::System.Console.WriteLine("Hello World");

:: 运算符也可以用于 using alias 指令 :The :: operator can also be used with a using alias directive:

// using Col=System.Collections.Generic;
var numbers = new Col::List<int> { 1, 2, 3 };

备注Remarks

命名空间别名限定符可以为 globalThe namespace alias qualifier can be global. 这将调用全局命名空间(而不是别名命名空间)中的查找。This invokes a lookup in the global namespace, rather than an aliased namespace.

更多相关信息For more information

有关如何使用 :: 运算符的示例,请参阅以下部分:For an example of how to use the :: operator, see the following section:

C# 语言规范C# language specification

有关详细信息,请参阅 C# 语言规范For more information, see the C# Language Specification. 该语言规范是 C# 语法和用法的权威资料。The language specification is the definitive source for C# syntax and usage.

请参阅See also