The .NET Framework Class Library

The .NET Framework provides a number of types that are already created and ready for use in any language that targets the Common Language Runtime. These types include such items as the primitive data types, I/O functions, data access, and .NET Framework security.

Perhaps one of the biggest changes in the way developers will work with VB .NET is the entire area of namespaces. Namespaces will be covered in Chapter 3, “Major VB .NET Changes,” but it is important to understand that the .NET Framework provides a host of utility classes and members, organized within a hierarchy called a namespace. At the root of the hierarchy is the System namespace. A namespace groups classes and members into logical nodes. This way, you can have the same name for a method in more than one namespace. The Left() method could therefore exist in the System.Windows.Forms namespace and the Microsoft.VisualBasic namespace.

One advantage of namespaces is that similar functions can be grouped within the same namespace, regardless of the assembly in which they are physically located. Any language targeting the runtime can use the System namespaces. For example, if you need to perform data access, you do not set a reference to the ADO.NET component. Instead, you reference, or import, the System.Data namespace. Often, you will see the following line:

Imports System.Data

This does not import all the methods and cause code bloat, however. Instead, it instructs the compiler to treat the methods and types within the namespace as part of your project's own namespace, so instead of having to write this:

System.Data.SQLClient()

You can simply make a call to

SQLClient()

There are many other System namespaces. System namespaces include the functionality for security, threading, text and binary I/O, and Web services. How to use various System namespaces is introduced throughout the book.

Don't let the term namespaces scare you. It is one of the most fundamental changes in VB .NET, but it is a service provided by the runtime that gives common, rich functionality to any language built on the runtime. As long as you inherit from the namespaces provided to you by the runtime, your application can run on any platform that supports .NET. In this way, you are working on learning the environment as much as you are learning the language. That's one reason why this chapter is the first in the book.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.137.14