What is "global::" in C# for?


I was editing source code for an application I'm writing in C#, which uses GTK+.

I have some knowledge of C#, but I didn't understand why some variables were written when I built the UI in "drag and drop" with global:: before the names.

See the code snippet:

private Gtk.VBox vbox2;

private global::Gtk.VBox vbox3;

private global::Gtk.Label tituloLogin;

private global::Gtk.Entry entry1;

private global::Gtk.Entry entry2;

What is this global:: ? What does he mean?


global:: references the global namespace. For example, you can redefine the System class, check it out:

class foo
    class System


Then, for example, if you want to use Console.WriteLine() in this scope, without conflict, you use:


I based my answer on this one.

Scroll to Top