global
using System;
class TestApp
{
// Define a new class called 'System' to cause problems.
public class System { }
// Define a constant called 'Console' to cause more problems.
const int Console = 7;
const int number = 66;
static void Main()
{
// The following line causes an error. It accesses TestApp.Console,
// which is a constant.
//Console.WriteLine(number);
}
}當左邊的識別項是 global 的時候,搜尋正確的識別項會從全域命名空間開始。
範例
Last updated