Global Keyword

Namespaces are versatile and enable the creation of complex infrastructures of objects. There could be situations in which you need to define namespaces with names already defined in the .NET Framework, such as System. Although this should never be done, you might face some problems. Consider the following code:

image

Such code will not be compiled because the compiler looks for a NotImplementedException within our System namespace and not the one of the Base Class Library. Although such a scenario is unusual, Microsoft’s developers provided a way for avoiding such problems. You can use the Global keyword to ensure that the compiler invokes ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.