SharpDeveloper
Proper use of global:: (or Global.)
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();
Related Reading:
Other Interesting Posts
-
Articles
- January 2011
- April 2010
- March 2010
- February 2010
- January 2010
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- February 2009
- December 2008
- November 2008
- October 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
-
Meta







