Other Namespaces VB.NET

Nested just below the System namespace are a number of second-level namespaces, which contain such classes as:

System.CodeDOM
Contains classes representing the elements and structure of a source code document.

System.Collections
Contains interfaces and classes that define various collections of objects, such as lists, queues, arrays, hashtables, and dictionaries.

System.ComponentModel
Contains classes that are used to implement the runtime and design-time behavior of components and controls.

System.Configuration
Contains classes that allow the creation of custom installers for software components.

System.Data
Consists mostly of the classes that constitute the ADO.NET architecture and are used for database connectivity.

System.Diagnostics
Contains classes that allow debugging of applications and code tracing.

System.DirectoryServices
Contains classes that provide access to the Active Directory from managed code.

System.Drawing
Contains classes that provide access to GDI+ basic graphics functionality. (More advanced functionality is provided in the System.Drawing.Drawing2D, System.Drawing.Imaging, and System.Drawing.Text namespaces.)

System.IO Contains classes that allow synchronous and asynchronous reading from and writing to data streams and files.

System.Net
Contains classes that provide a simple programming interface to many of the common network protocols, such as FTP and HTTP. (The System.Net.Sockets namespace provides lower-level network access control.)

System.Reflection
Contains classes and interfaces that provide a managed view of loaded types, methods, and fields, with the ability to create and invoke types dynamically.

System.Resources
Contains classes for managing resources (culture-specific resources and resource files).

System.Security
Contains classes that provide access to the underlying structure of the .NET Framework security system.

System.ServiceProcess
Contains classes that allow us to install and run services. (Services are long-running executables that run without a user interface.)

System.Text
Contains classes representing ASCII, Unicode, UTF-7, and UTF-8 character encodings, as well as abstract base classes for converting blocks of characters to and from blocks of bytes, and more.

System.Text.RegularExpressions
Contains classes that provide access to the .NET Framework regular expression engine.

System.Threading
Provides classes and interfaces that enable multithreaded programming.

System.Timers
Contains classes that provide the Timer component, which allows you to raise an event on a specified interval.

System.Web and related namespaces
Contain classes and interfaces that enable browser/server communication and that allow you to develop ASP.NET applications and web services.

System.Windows.Forms
Contains classes for creating Windows-based applications that take full advantage of the rich user-interface features available in the Microsoft Windows operating system. In this namespace, you will find the Form class and many other controls that can be added to forms to create user interfaces.

System.Xml
Contains classes that provide standards-based support for processing XML.

Let's take a look at some of these other classes in the BCL.

System.Collections
This namespace contains classes for implementing a variety of collection types, such as stacks and queues. As you may know, a queue is a first-in, first-out data structure. The following code illustrates the use of the Queue class:

System.Data
System.Data and its nested namespaces, notably System.Data.OleDb and System.Data.SqlClient, provide data access using ADO.NET. The OleDb and SqlClient namespaces are responsible for defining data providers that can connect to a data source, retrieve data from a data source, write data back to a data source, and execute commands against the data source. The most important class in each of these namespaces is a data adapter class (in the OleDb namespace, it's the OleDbDataAdapter class; in the SqlClient namespace, it's the SqlDataAdapter class) which is responsible for retrieving data from a data source and writing it to a dataset. A dataset in turn is a collection of related data that's disconnected from its original data source.

ADO.NET is not the same thing as ADO, nor is ADO.NET a new version of ADO. Instead, ADO (or ActiveX Data Objects) is a COM-based object model for data access. ADO.NET is an entirely new model for data access that is based on the disconnected dataset.

System.IO
The System.IO namespace contains classes that provide a variety of input/output functionality, such as:

  • Manipulating directories (Directory class) and files (File class)
  • Monitoring changes in directories and files (FileSystemWatcher class)
  • Reading and writing single bytes, mulitbyte blocks, or characters to and from streams
  • Reading and writing characters to and from strings (StringReader and StringWriter)
  • Writing and reading data types and objects to and from streams (BinaryWriter and binaryReader)
  • Providing random access to files (FileStream)

It appears that, for VB programmers, the System.IO namespace and its classes are intended to take the place of the FileSystemObject object model that is part of the Microsoft Scripting Runtime. The System.IO namespace is certainly much more extensive. The File and Directory classes duplicate the functionality of the FileSystemObject.

System.Text.RegularExpressions
The System.Text.RegularExpressions namespace contains classes that provide access to the .NET Framework's regular expression engine. This is not the place to go into details about regular expressions, but we can make a few comments.

In its simplest form, a regular expression is a text string that represents a pattern that other strings may or may not match. In this way, regular expressions form a very powerful method of string matching. In more complicated forms, a regular expression is a kind of programming statement. For instance, the expression:

s/ab*c/def

says to match the given string against the regular expression ab*c (strings that start with ab and end with c). If a match exists, then replace the given string with the string def. Here are some simple regular expressions for pattern matching:

Single character
This is matched only by itself.

This matches any single character that belongs to the string of characters. For example, [abc] matches the single character a, b, or c. A dash can also be used in the character list, for instance, [0-9] matches any single digit. We can also write [0-9a-z] to match any single digit or any single lowercase character, and [a-zA-Z] to match any single lower- or uppercase character.

The ^ symbol can be used to negate the match. For instance, [^0-9] matches any character except a digit.

Special match abbreviations

thus matching any letter or underscore; W is the negation of w.

Asterisk (* )
The occurrence of an asterisk within a regular expression gives a match if and only if there are zero or more repeated instances of the single character preceding the asterisk. For example, the regular expression da*d is matched by any string beginning with a single digit, continuing with zero or more as and ending with a single digit, as with 01 or 0aaa1.

Plus sign (+ )
The occurrence of a plus sign within a regular expression gives a match if and only if there are one or more repeated instances of the single character preceding the plus sign. For example, the regular expression da+d is matched by any string beginning with a single digit, continuing with one or more as and ending with a single digit, as with 0aaa1 (but not 01).

Question mark (? )
The occurrence of a question mark within a regular expression gives a match if and only if there are zero or one instances of the single character preceding the question mark. For example, the regular expression da?d is matched by any string beginning with a single digit, continuing with zero or one as and ending with a single digit, as with 01 and 0a1.

General multiplier
The occurrence of the substring {x,y}, where x and y are nonnegative integers within a regular expression, gives a match if and only if there are at least x but at most y instances of the single character preceding the opening bracket. For example, the regular expression da{5,10}d is matched by any string beginning with a single digit, continuing with at least 5 but at most 10 as and ending with a single digit, as with 0aaaaaa1.

Note that you can leave out one of x or y. Thus, {x,} means "at least x," and {,y} means "at most y."

The System.Text.RegularExpressions namespace has a Regex class, whose objects represent regular expressions. Here is a simple example of the use of the Regex class:

The System.Text.RegularExpressions namespace contains classes for string replacement as well, but we do not go into these matters in this brief introduction.

System.Windows.Forms
This namespace is the mother of all namespaces for creating Windows applications. To quote the documentation:

The System.Windows.Forms namespace contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system. In this namespace you will find the Form class and many other controls that can be added to forms to create user interfaces.

In fact, each new form added to a VB .NET project contains the line:

Fortunately, Visual Studio provides the functionality of the System.Windows.Forms namespace to us as VB programmers, so we don't need to program directly against this namespace



Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

VB.NET Topics