devxlogo

Visual Basic Book Excerpt: Useful Namespaces

Visual Basic Book Excerpt: Useful Namespaces

This is an excerpt from the book “Visual Basic 2010 Programmer’s Reference,” by Rod Stephens. In the book, Stephens provides programmers and developers of all skill levels with a comprehensive tutorial and reference to Visual Basic 2010. He presents a broad, solid understanding of essential topics on the latest version of VB.

This following is part of Chapter 39, “Useful Namespaces,” which describes some of the more useful namespaces defined by the .NET Framework. It provides a brief overview of some of the most important System namespaces and gives more detailed examples that demonstrate regular expressions, XML, cryptography, reflection, threading, parallel programming, and Direct3D.

Chapter 39: Useful Namespaces

The .NET Framework is a library of classes, interfaces, and types that add extra power to Visual Studio .NET. These features go beyond what is normally provided by a programming language such as Visual Basic.

The .NET Framework is truly enormous. To make it more manageable, Microsoft has broken it into namespaces. The namespaces form a hierarchical catalog that groups related classes and functions in a meaningful way.

For example, the System namespace contains basic classes and methods that an application can use to perform common tasks. The System.Drawing namespace is the part of the System namespace that holds graphical tools. The System.Drawing.Design, System.Drawing.Drawing2D, System.Drawing.Imaging, System.Drawing.Printing, and System.Drawing.Text namespaces further subdivide System.Drawing into finer groupings.

Many of the .NET Framework namespaces are essential for day-to-day programming. For example, many Visual Basic applications need to produce printouts, so they use the System.Drawing.Printing namespace. Different applications draw graphics or images on the screen, so they need to use other System.Drawing namespaces.

Because so much of the .NET Framework is used in everyday programming tasks, this book doesn’t strongly differentiate between Visual Basic and .NET Framework functionality. Presumably, the book could have focused solely on the Visual Basic language and ignored the .NET Framework, but it would have been a much less useful book.

Although the book covers many useful .NET Framework features, there’s a huge amount that it doesn’t cover. The .NET Framework includes hundreds of namespaces that define a huge number of classes, types, enumerated values, and other paraphernalia.

The following sections describe some of the highest-level and most useful namespaces provided by the .NET Framework.

Root Namespaces

Initially a Windows application includes two root namespaces: Microsoft and System.type=”general”

Namespaces Galore

Your program may include references to many other namespaces. If you add references to development libraries, your program will have access to their namespaces. For example, you might have Amazon.com, Google, eBay, and other development toolkits installed, and they come with their own namespaces. Later versions of Windows will also provide namespaces that you may want to reference.

Also note that the My namespace provides shortcuts that make common programming tasks easier. For more information on the My namespace, see the section “My” in Chapter 36, “Configuration and Resources,” and Appendix S, “The My Namespace.”

The Microsoft Namespace

The Microsoft root namespace contains Microsoft-specific items. In theory, any vendor can implement .NET languages that translate into Intermediate Language (IL) code. If you were to build such a language, the items in the Microsoft namespace would generally not apply to your language. Items in the System namespace described next would be as useful to users of your language as they are to programmers who use the Microsoft languages, but the items in the Microsoft namespace would probably not be as helpful.

For the full chapter, go to: “Visual Basic 2010 Programmer’s Reference.”

Reproduced from “Visual Basic 2010 Programmer’s Reference,” by permission of Wiley. All rights reserved.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist