- .NET: What You Need to Know
- What Is Microsoft .NET?
- .NET Framework Overview
- Common Language Runtime
- Summary
.NET Framework Overview
The .NET Framework consists of the CLR, the .NET Framework Class Library, the Common Language Specification (CLS), a number of .NET languages, and Visual Studio.NET. The overall architecture of the .NET Framework is depicted in Figure 12.
Figure 12 Overall block diagram of .NET Framework.
Common Language Runtime
A runtime provides services to executing programs. Traditionally, different programming environments have different runtimes. Examples of runtimes include the standard C library, MFC, the Visual Basic runtime, and the Java Virtual Machine (JVM).
The runtime environment provided by .NET, the CLR, manages the execution of code and provides useful services. The services of the CLR are exposed through programming languages. The syntax for these services varies from language to language, but the underlying execution engine providing the services is the same.
Not all languages expose all the features of the CLR. The language with the best mapping to the CLR is the new language C#. VB.NET, however, does an admirable job of exposing the functionality.
.NET Framework Class Library
The .NET Framework class library is huge, comprising more than 2,500 classes. All this functionality is available to all the .NET languages. The library (see Figure 13) consists of four main parts:
Base class library (which includes networking, security, diagnostics, I/O, and other types of operating system services)
Data and XML classes
Windows UI
Web services and Web UI
Figure 13 Block diagram of .NET Framework Class Library.
Common Language Specification
An important goal of the .NET Framework is to support multiple languages. But all languages are not created equal, so it is important to agree upon a common subset that all languages will support. The CLS is an agreement among language designers and class library designers about those features and usage conventions that can be relied upon.
CLS rules apply to public features that are visible outside the assembly where they are defined. (An assembly can be thought of as a logical EXE or DLL and will be discussed later in this chapter.) For example, the CLS requires that public names do not rely on case for uniqueness, because some languages are not case sensitive. For more information, see "Cross Language Interoperability" in "Inside the .NET Framework" in the .NET Framework SDK documentation.
Languages in .NET
A language is a CLS-compliant consumer if it can use any CLS-compliant typethat is, if it can call methods, create instances of types, and so on. (A type is basically a class in most object-oriented languages, providing an abstraction of data and behavior, grouped together.) A language is a CLS-compliant extender if it is a consumer and can also extend any CLS-compliant base class, implement any CLS-compliant interface, and so on.
Microsoft itself is providing four CLS-compliant languages. VB.NET, C#, and C++ with Managed Extensions are extenders. JScript.NET is a consumer.
Third parties are providing additional languages (more than a dozen so far). Active-State is implementing Perl and Python. Fujitsu is implementing COBOL. It should be noted that at present some of these languages are not .NET languages in the strict sense. For example, ActiveState provides a tool called PerlNET that will create a .NET component from a Perl class. This facility enables .NET applications to call the wealth of Perl modules, but it does not make Perl into either a consumer or an extender. For more information on PerlNET, see the book Programming Perl in the .NET Environment (Saltzman, Oberg), another book in The Integrated .NET Series.