Appendix E. Cross-Language Code Interoperability

An important feature of Microsoft .NET is the common language runtime (CLR) support for multiple languages. As well as enabling applications written in different languages to run, CLR support for cross-language integration allows components developed in one language to be used and extended by components developed in other languages. Specifically, this allows

  • Classes defined in one language to be inherited and extended by classes defined in another language, including support for overriding virtual methods.

  • Interfaces defined in one language to be implemented by types defined in another language.

  • The instantiation and use of types written in other languages, including the passing of types defined in another language as parameters.

  • The handling of exceptions thrown by components written in another language.

    Cross-language integration is possible because

  • Assemblies contain metadata that describes the characteristics and requirements of the contained types.

  • All languages compile to a common intermediate language (IL).

  • All applications execute in the context of a shared, managed execution environment (the CLR) and share a Common Type System (CTS).

The Common Type System

The CTS defines how types are declared, used, and managed within the CLR. The CTS defines a rich set of types and operations, enough to support the complete implementation of many different languages. The CTS provides the basis for cross-language integration. However, every programming language offers different capabilities, and not all languages support every feature of the CTS. A subset of the CTS necessary to support cross-language integration has been defined as the Common Language Specification (CLS). Any .NET language that implements the features defined by the CLS can be used to produce components that support cross-language integration.

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

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