March 3, 2021
Hot Topics:

The Book of Visual Studio .NET - A Visual Basic .NET Crash Course

  • By Developer.com Staff
  • Send Email »
  • More Articles »

Implementing Namespaces

Namespaces make it easy to organize classes, functions, data types, and structures into a hierarchy. Namespaces allow you to quickly access classes and methods buried in the .NET Framework Class Library or any other application that provides a namespace. The .NET Framework Class Library provides hundreds of classes and thousands of functions as well as data types and structures.

Use the Imports statement to import a namespace for easy access to its classes and methods. Once imported it is no longer necessary to use a fully qualified path to the desired class or method. For example:

Imports system.text ' Give access to the StringBuilder class

Table 7-2 lists the namespaces that are used most commonly and their general functionality.

Table 7-2: Commonly Used Namespaces
Namespace Functionality

Microsoft.VisualBasic Contains the Visual Basic .NET runtime, classes, and methods used for compiling Visual Basic code.

Microsoft.VSA Provides a host of scripting functionality, allowing you to give users the ability to customize of your application.

Microsoft.Win32 Provides access to the Windows Registry and the ability to handle events raised by the operating system.

System Provides basic classes and methods commonly used by all .NET languages. Includes data types, arrays, exception classes, Math functions, Garbage collector, conversion classes, console access, and the Object class along with many more commonly used components.

System.Collection Provides interfaces and classes used for creating a variety of collection types.

Collection types are

  • ArrayList: Basic collection object.
  • BitArray: A collection of bits. (0 and 1 values)
  • DictionaryBase: Implements base class for strongly typed collections supporting key (name) value pairs.
  • HashTable: High performing collection of key (name) value pairs.
  • Queue: FIFO (First-in First-out) collection.
  • SortedList: A collection of key (name) value pairs sorted by the key (name).
  • Stack: LIFO (Last-in First-out) collection.
  • Specialized.ListDictionary: A faster collection than a HashTable for 10 items or less.
  • Specialized.HybridDictionary: Acts as a ListDictionary until the collection gets larger where it converts to a HashTable.
  • Specialized.StringCollection: A collection of strings.

System.ComponentModel Provides classes and interfaces for runtime and design time behavior including the ability to contain or to be contained.

The Container interface allows the Visual Studio .NET development environment to provide a graphical interface when developing a component.

System.Data Provides classes and interfaces to support data access including ADO.NET, XML, OLEDB, and SQL Server access.

System.Diagnostics Provides classes, allowing access to

  • Event Log: A mechanism employed by the operating systems providing a common area to record application and system events. Events can include errors, warnings, and informational data.

  • Processes: Provides the ability start and stop processes as well as monitor processes on remote machines.

  • Performance Counters: Provides the ability to monitor performance of local and remote machines including the ability to define and create customer performance counters.

System.DirectoryServices Provides the ability to search and interact with Active Directory services providers:

  • Active Directory is a hieratical mean for logically organizing network and system resources.

  • Active Directory providers include IIS, LDAP (Lightweight Directory Access Protocol), NDS (Novel NetWare Directory Service), and WinNT directory services.

System.EnterpriseService Provides the ability to employ COM+ functionality for building enterprise applications.

System.Globalization Provides classes supporting multiple languages and cultures including date formats, calendars, and currencies.

System.IO Provides read and write access to data streams and files. Additional access is provided to related tasks including:

  • Manipulation of the creation, modification, and deletion or file directories.

  • Manipulation of files through creation, modification, deletion, coping, and moving.

  • Provides information about files and directories, such as the existence of a file or directory, the extension of files, and the full path of files.

  • Allows access to system events including file system changes.

System.Management Provides access to information provided by WMI (Windows Management Instrumentation) including information about a systems drive space and CPU Utilization. Please refer to WMI for additional information concerning data that can be derived from the System.Management namespace.

System.Messaging Provides classes for managing Message Queues.

System.Net Provides classes for commonly used network protocols.

System.Reflection Provides classes for access to component metadata stored in an assemblies manifest.

System.Runtime.Remoting Provides classes designed for building distributed applications similar to classic DCOM (Distributed Component Object Model).

System.Runtime.Serialization Provides classes designed to serialize objects into a sequence of bits for storage or transfer to another system.

System.Security Implements the CLR's (Common Language Runtime) security components.

System.ServiceProcess Provides classes required for building Windows Services.

System.Text Provides classes for manipulating string data. Most notable is the StringBuilder class defining a modern approach to string manipulation.

System.Tread Provides classes for building multi-threaded applications.

System.Timer Provides classes for implementing non-visual timed events allowing actions to be taken on a given interval.

System.Web Provides classes and additional subordinate namespaces encompassing all aspects of web development including ASP .NET, Web Services, and web controls and more.

System.Windows.Forms Provides classes required for developing windows form applications.

System.XML Provides classes for manipulating and using XML.

This ends the first of three parts of a sample chapter from The Book of Visual Studio .NET, ISBN 1-886411-69-7 from No Starch Press

# # #

Page 5 of 5

This article was originally published on January 15, 2003

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date