Elements of the .NET Framework


Figure 1.1 shows an extremely simplified view of the architecture and relationships between elements of the .NET Framework. The CLR is the base on which all of the .NET Framework's other facilities are built. In particular, the CLR is responsible for addressing most of the "programming in the small" issues that have been identified with developing distributed systems. On top of the CLR is a Base Framework, a set of class libraries that can be used and shared by any .NET-aware language. The CLR and fundamental parts of the Base Framework are collectively known as the Common Language Infrastructure (CLI); the CLI has been standardized by ECMA. [2]

[2] See http://www.ecma.ch/.

Figure 1.1. .NET Framework

graphics/01fig01.gif

Common Language Runtime

The CLR is a core component of the .NET Framework. It consists of three main components :

  • A type system that supports many of the types and operations found in modern programming languages

  • A metadata system that allows metadata to be persisted along with types at compile time and then be interrogated by other CLR compilers or the execution system at runtime

  • An execution system that executes CLR programs, utilizing the metadata to perform such services as memory management

On one level, the CLR may be considered to be the union of the features of many programming languages and architectures. It defines standard types, permits developers to define their own types, and allows developers to specify interfaces and methods for their types. The CLR allows compilers to store metadata with the user -defined types, enabling other languages to inspect, use, and extend these types. In addition, the CLR provides a safe and secure environment for program execution. It readily supports an object-oriented programming style characterized by classification, inheritance, and polymorphism. Similarly, the CLR can support non “object-oriented languages.

If the CLR represents a superset of programming features, then it is clear that most ”if not all ”programming languages cannot support every facility in the CLR. An agreed minimum subset that almost all languages can support is defined in the Common Language Specification (CLS). The CLS is a set of rules that limits the type system and parts of the execution system to a certain group of the facilities provided by the CLR. The resulting feature set is designed to support interoperability between most programming languages. The CLS is, however, rich enough that nearly all meaningful libraries can be written using only CLS-compliant features. As a simple example demonstrating the relationship between the CLR's type system and the CLS, consider the integer types: The CLR supports both signed and unsigned integers, whereas CLS-compliant languages need to support only signed integers. Note that the CLS refers to only the publicly exposed aspects of a type; internally, a type can use any of the CLR's features while still remaining CLS compliant.

Base Framework

The Base Framework provides a number of fundamental classes, of which every application will use a subset. These classes include Object , String , and Type :

  • The Object class serves as the base class for all classes. It provides a number of methods, including those that allow developers to access metadata about any type.

  • The String class represents a Unicode string that can be shared between programming languages and different cultures. Its availability eliminates the need to perform difficult and unnatural conversions between different string types ”for example, between char* (C++) and BSTRs (Visual Basic) in COM.

  • The Type class is the fundamental building block that enables executing programs to gain access to the metadata system. An object can be asked for a Type object that provides all the information about that type.

These fundamental classes are described in detail in Chapters 2 “4.



Programming in the .NET Environment
Programming in the .NET Environment
ISBN: 0201770180
EAN: 2147483647
Year: 2002
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net