13.1. Introduction to the .NET Framework

The Microsoft .NET Framework version 1.1 consists of two main elements: the common language runtime (CLR) and .NET Framework class library. These two elements actually handle a lot of work for developers, managing threads and memory (CLR), and allowing just about unlimited expandability (class library). The CLR is used "under the covers" in that it handles translating managed code into something that can run on any platform supporting .NET. You can see how these elements fit together in Figure 13-1.

Figure 13.1. Figure 13-1

There are a number of reasons for using the .NET Framework for a development platform. Here are some of those reasons:

  • Guarantees Safe Execution of Code, Including Code Created by Unknown or Semi-Trusted Third Parties: This is where the term managed code comes from, since the applications have to meet security standards and are managed just for that very purpose.

  • Allows Developers to Work in a Consistent Programming Environment Whether Creating Applications for Desktops or the Internet: This means that although there are techniques that vary between Web and desktop applications, you can use the same languages, such as C#.

  • Builds All Communication on Industry Standards to Ensure That Code Based on the .NET Framework Can Be Integrated with Any Other Code: .NET uses XML extensively, as well as other communication protocols such as SOAP (Simplified Object Application Programming), which are both industry standards.

  • Minimizes Software Deployment and Versioning Conflicts: Also called DLL hell, when developing in prior platforms such as Visual Basic and using ActiveX controls. Many times when you installed new versions of your applications, controls would conflict and not work.

  • Eliminates Performance Problems of Scripted or Interpreted Environments: Everything is compiled into a common language that the various parts of the platform are designed to work with.

13.1.1. Common Language Runtime

The common language runtime is a runtime engine that takes various languages, such as Visual Basic .NET and C#, and compiles them into a common language that is used when the applications are executed. This means that all the languages can use the same classes provided by the .NET Framework class library.

The CLR is extremely convenient and powerful in that it really doesn't matter which language you write in, because you can use the same objects and it all compiles down to the same efficient code.

13.1.2. .NET Framework Class Library

The .NET Framework class library is made up of various namespaces. Namespaces are actually collections of classes and interfaces, logically organized. This enables you to have multiple versions of classes with the same name, but in different namespaces, and not have conflicts.

One very interesting fact is that not only does the .NET Framework provide namespaces and classes for developer use, but it also uses those very namespaces and classes for its own purposes, including editing, compiling, and executing code.

Another big benefit of using the .NET Framework class library is the ability to use the classes in your applications consistently no matter whether you are using C# or Visual Basic .NET, Windows or Web forms. Namespaces can also be made up of other namespaces.

The best way to get into the .NET Framework class library is to take a look at some of its namespaces. You can see some of those namespaces in the following table:

NamespaceDescription
SystemMain system namespace that is broken into many categories.
System.DataMakes up the classes used for ADO.NET, and overall data manipulation of just about any kind. Subnamespaces of System.Data include System.Data.SqlClient and System.Data.OleDB.
System.XMLIncludes the DOM and classes for using XML in your applications.
System.WebNamespaces and classes used for creating ASP.NET applications.
System.WindowsNamespaces and classes for creating Windows forms applications.

When you create a .NET application, Visual Studio creates references to different namespaces, based on what kind of project you are creating. You can see an example of references created in an InfoPath type .NET project in Figure 13-2.

Figure 13.2. Figure 13-2

The Microsoft.Office.Interop.InfoPath.SemiTrust namespace is installed in the .NET Framework when the InfoPath 2003 Toolkit for Visual Studio .NET is installed, which is covered quickly once again in the section titled "Review: Installing the InfoPath 2003 Toolkit for Visual Studio .NET."

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

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