.NET Language Integration Components


The .NET Framework offers internal interoperability between programming languages supported by Microsoft. Three specification components, discussed in detail in Chapter 5, define the .NET Framework:

  • Common Language Runtime (CLR)

  • Common Type Specification (CTS)

  • Common Language Specification (CLS)

Common Language Runtime Tasks

The CLR’s primary task is to generate a .NET assembly as well as metadata that describes every data type residing within the assembly’s binary. The CLR also identifies the assembly’s version. This allows COM binaries and assemblies to coexist side by side without causing an exception. Once it has read the assembly’s metadata, the Intermediate Language (IL) code compiles to a platform-specific set of application instructions.

Note

This is similar to Java’s method of compiling code into bytecode, a cross-platform intermediary. At runtime, the Java Runtime Environment (JRE) interprets the bytecode and then executes it.

All programming languages targeting the .NET Framework must adhere to base class libraries provided by the Framework in order to achieve interoperability. Additionally, the CLR supports cross-language exception handling and debugging.

The .NET assembly manifest includes a detailed assembly description as well as identifying a list of externally referenced assemblies required for application execution. The CLR generates both single-file assemblies and multi-file assemblies. The first type is a single binary, whereas the multi-file assembly contains more than one binary.

CTS Supports Data Type Interoperability

The Type refers to a collection of classes, interfaces, structures, delegates, and enumerations supported by the runtime engine. An alternative is to build custom data types and place them in a unique namespace, thereby eliminating name conflicts between assemblies. For those who are VB 6 developers, the Common Type System Structure replaces VB 6.0 Types. VB 6.0 supported the Type keyword, allowing for the creation of user-defined types. However, in the .NET environment, Structure defines numeric types such as complex numbers. The CTS provides information on all data types supported by the runtime. Through reflection, the CTS describes how data types interact with each other.

Note

Structures can implement any number of interfaces but cannot derive from other base types. Rather, they are sealed. (A sealed modifier prevents a derived class from further overriding a specified method.)

The Common Language Specification

The CLS provides a set of guidelines explaining rules that a .NET-aware compiler must follow in order for generated code to be eligible for support by the CLR. The CLS permits all languages supported by the .NET Framework to share Intermediate Language (IL) code.

Note

Write your applications with CLS-compliant data types to ensure interoperability with other .NET-targeted languages.

Private variables declared within a function or subroutine can use nonsupported data types and still achieve interoperability.




.NET & J2EE Interoperability
Microsoft .NET and J2EE Interoperability Toolkit (Pro-Developer)
ISBN: 0735619220
EAN: 2147483647
Year: 2004
Pages: 101
Authors: Simon Guest

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