Accessing the global namespace

Published Thu, Jan 15 2009 15:15

Even though it exists for a long time, there are still some guys which are surprised whenever they see something like this:

global::System.Console.WriteLine( “Hello” );

what is that global:: thing over there? Well, it’s there for saying that search for the System.Console class should start at the global namespace. You’ll need this kind of thing whenever you have types/namespaces that hide the global ones. The documentation on MSDN explains all these concepts really well, so I’ll just redirect you there.

btw, it’s possible that you’ll end up seeing this code generated by tools (if I’m not mistaken, you’ll be seeing it whenever you look at the code generated for the classes that are mapped into tables on the EF framework).

Filed under:

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above:  

Search

This Blog

Tags

Community

Archives

Syndication

Email Notifications

News




  • View Luis Abreu's profile on LinkedIn


    Follow me at Twitter

    My books

    Silverlight 4.0: Curso Completo

    ASP.NET 4.0: Curso Completo

    Portuguese LINQ book cover

    Portuguese ASP.NET 3.5 book cover

    Portuguese ASP.NET AJAX book cover

    Portuguese ASP.NET AJAX book cover