25-03-2011, 09:52 AM
CS761-2.ppt (Size: 339 KB / Downloads: 72)
Building Blocks of .NET
Objectives
Details of CLR
Overview of .NET Assemblies
Single-file and Multifile Assemblies
Role and Benefits of CIL
Role of .NET type Metadata
Role of Assembly Manifest
CTS Types
Common Language Runtime
Runtime Environment in which programs are written in C# and .NET languages are executed
Services
Loading and Execution of Programs
Supports Cross-Language Interoperability
Type Safety
Compiling IL with executable code
Metadata
Memory Management ( Automatic Garbage collection)
Security
Interoperability with other systems
Managing Exceptions and errors
Debugging and Profiling
Components of CLR
CLR Activities while executing a Program
How CLR Works?
Any Program compiled to IL can be run in any .NET environment using CLR leading to portability
Output after compiling C# program – metadata
Describe data used by program and enables code to interact with other code
Exist along with MSIL in same file
Common Type System
Built into CLR
Multiple Language Support
Supports different types and operations found in most Programming Languages and henceforth no Type Casting
Base Class Libraries
Library in .NET to implement applications quickly
Instantiate and invoke the methods in it or inherit from derived classes
Vast Namespace
Eg. System
Tasks of Framework Base Classes
What C# brings ?
C# - Cleaned up version of Java which is cleaned up version of C++
No pointers
Automatic memory management
Formal Syntactical constructs for enumerations, structures, class properties
Operator Overloading
Ability to build generic types and members like C ++ templates
Support Interface based programming technique
Support Aspect Oriented programming via. Attributes ( Assign characters to types and members)
What C# brings Life in Multilanguage World
Need for more than one compiler when all .NET language compiles to Managed Code
Programmers opt different languages for different purpose and would like to have a combination of all good features together
Overview of .NET Assemblies
.NET Binaries ( *.dll / *.exe)
When *.dll or *.exe created by .NET compiler resulting module bundled into assembly (IL & Metadata)
Metadata describe every “type” in binary
Assemblies themselves described by metadata called manifest (version of assembly)
Role of Assembly Manifest
Metadata describing assembly – manifest
Documents external assemblies required by current assembly to function correctly
Assembly version number
Copyright Information
Module Name
Single-File and Multifile Assemblies
Assembly with a single *.dll or *.exe module
Required CIL, Metadata and associated manifest bundled into a single well defined package
Multifile Assemblies have many .NET binaries, each called as module
One Module act as primary module(with assembly manifest, CIL & metadata and rest have
module level manifest,CIL & metadata )
Adv : Easy Deployment
Role of CIL
Pseudo code
Portable Assembly Language
Not Specific to CPU
Not Executable
Different from Java’s bytecode
Instruction Set into which all .NET programs are compiled
Contains Instructions for Loading, Storing, Initializing and Calling Methods
Platform-Agonostic
Compiling CIL to Platform Specific Instructions
.NET Environment leverages a JIT compiler for each CPU targeting the runtime (optimized for underlying platform
Eg.for High end Server JIT functions as a high-memory environment and for a pocket held device as a low-memory environment
Same code can be JIT-compiled and executed on machines with different architectures
Caches results in main memory which can be reused during later recall ( No recompilation)
Role of .NET Type Metadata
.NET Assembly has Metadata along with CIL
Describes every type in binary such as class, Structure, Enumeration, Delegate, et.al
Also their methods such as properties, methods, events, et.al
Due to self-describing nature, no need of .NET binaries getting registered to system registry
Backbone for many .NET technologies like XML Web services, Object Serialization
CTS Types
Summary
Details of CLR
Overview of .NET Assemblies
Single-file and Multifile Assemblies
Role and Benefits of CIL
Role of .NET type Metadata
Role of Assembly Manifest
CTS Types