1 / 16

The Common Language Runtime (CLR)

The Common Language Runtime (CLR). The engine responsible for executing managed code . Managed code – code written and compiled in a .NET language and compiler. CLR - Key Features. Cross language integration Cross language exception handling

Télécharger la présentation

The Common Language Runtime (CLR)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Common Language Runtime (CLR) • The engine responsible for executing managed code. • Managed code – code written and compiled in a .NET language and compiler

  2. CLR - KeyFeatures • Cross language integration • Cross language exception handling • Automatic memory management – garbage collection • Code access security • Side – by – side execution • Easier deployment and versioning

  3. CLR – Major Components

  4. Intermediate language (IL) • Full name – Microsoft Intermediate Language (MSIL) • Non native compiled code • A sort of assembly language • Only calls to functions defined in the .NET core types and base classes • No calls to Windows API • CPU Independent - no CPU specific functions and calls

  5. Just – In – Time Compilation (JIT) • IL code is loaded by the CLR and compiled into machine code • Compilation on “as needed” basis on first call • Compiled code cached for subsequent requests • Code checked for type safety - compiler ensures that the code doesn’t try to access invalid memory addresses and that it returns and passes variables of the right type

  6. Metadata • Information about the types used and referenced by the IL code • Name of the types(classes), class members, parameters, references to other types • Advantages: • Code safety and verification • Reflection - ability to examine metadata in code • IntelliSense – Visual Studio feature

  7. Assembly • A product of compilation (IL + metadata) • Assemblies are Portable Executables (PE) - The smallest unit of code that can be executed and reused. • Made of one or more managed modules and resource files (optional), such as images • Manifest – lists all the files that the assembly is made of

  8. The format of a .NET PE file

  9. The Common Type System (CTS) • Value types • Reference types • Boxing and unboxing • Classes, properties, indexers • Interfaces • Delegates • Generics

  10. What Is A Type? • The CTS provides every language running on the .NET platform with a base set of data types (classes) • Two Categories • Value Types: Value types directly contain their data. • Reference Types: Reference types store a reference to the value's memory address

  11. The Common Type System (CTS)

  12. The Common Type System (CTS) • Types are defined by CLR, hence they are the same across languages

  13. The Common Language Specification (CLS) • A series of basic rules that are required for language integration • Spells out the minimum requirements for being a .NET language • Compiler vendors can build their compilers to the specification and provide languages that target .NET.

  14. The Framework Class Libraray (FCL) • Thousands of classes and interfaces • Encapsulate a lot of system objects and functionality that help us write: • Windows Applications (Win Forms, WPF Applications, Windows Services) • ASP.NET Applications – use server side controls • Web Services – the FCL classes hide all the underlying details of SOAP and network communications

  15. Integrated Development Environments (IDE) • Visual Studio.NET • Visual C#.NET • We will use it in this class http://www.microsoft.com/express/download/

More Related