Use of Global in C#

Definition From MSDN

The global contextual keyword, when it comes before the :: operator, refers to the global namespace, which is the default namespace for any C# program and is otherwise unnamed.

 

static void Main(string[] args)
{

// Define a Console integer to create a conflict

const int Console = 1;

// Console.WriteLine(“Test”); will not work as Console is a integer in the scope

// global in the following line says it has to refer to the Global namespace and not the current namespace.
global::System.Console.WriteLine(“Test”);
global::System.Console.ReadLine();
}

Hope You Understood 🙂 .

Advertisements

2 thoughts on “Use of Global in C#

  1. can u give more clarification

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s