320 likes | 911 Views
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
E N D
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 - KeyFeatures • Cross language integration • Cross language exception handling • Automatic memory management – garbage collection • Code access security • Side – by – side execution • Easier deployment and versioning
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
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
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
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
The Common Type System (CTS) • Value types • Reference types • Boxing and unboxing • Classes, properties, indexers • Interfaces • Delegates • Generics
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
The Common Type System (CTS) • Types are defined by CLR, hence they are the same across languages
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.
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
Integrated Development Environments (IDE) • Visual Studio.NET • Visual C#.NET • We will use it in this class http://www.microsoft.com/express/download/