The C# keyword global:: (also known as Global.) allows .NET to differentiate between two namespaces.

Say you have a namespace called Common, and you have a class called Setup

In that case, to refer to a function inside it called GetUsersOnline(), you would write Common.Setup.GetUsersOnline()

 However, say that you are currently working within the Accounting namespace, and the accounting namespace had a class called Common.  If you tried to type Common.GetUsersOnline(), .NET would say,… hey!  Accounting.Common exists, but there is no GetUsersOnline() in there.. So.. crash

So in order to help .NET solve this mystery, append global:: to the beginning of the namespace, and all will be fine.

global::Common.GetUsersOnline();


Other Interesting Posts

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*


8 + 4 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>