Unit 1-1
Unit 1-1
NET Framework
Execution In CLR
Unit 1. Overview of Microsoft .NET Framework
• It is a set of rules and constraints that all language must follow which want to be
compatible with .NET framework.
• It is used to support the theme of .NET i.e. unification and interoperability (The ability
of computer systems or software to exchange and make use of information). That means,
if we want the code which we write in a language to be used by programs in other
language(cross-language integration) then it should hold on to the CLS.
• Thus the CLS describes a set of features that are common different languages.
CLS performs the following functions:
Assembly All of the managed code that runs in .NET must be contained in an assembly. Logically,
the assembly is referenced as one EXE or DLL file. Physically, it may consist of a collection of one
or more files that contain code or resources such as images or XML data. An assembly is created
when a .NET compatible compiler converts a file containing source code into a DLL or EXE file.
Manifest. Each assembly must have one file that contains a manifest. The manifest is a set of
tables containing metadata that lists the names of all files in the assembly, references to external
assemblies, and information such as name and version that identify the assembly.
Metadata When a compiler produces Microsoft Intermediate Language (MSIL), it also produces
Metadata (Data about Data). Metadata is nothing but a description of every namespace, class,
method, Property etc. The Microsoft Intermediate Language (MSIL) and Metadata are
contained in a portable executable (PE) file. It allows loading and locating code, enforcing code
security, generating native code, and providing reflection at runtime.
• .NET Framework provides runtime environment called Common Language Runtime (CLR).It
is the heart of .net framework. It is the engine that compiles and run the application. It
uses MSIL code which is language independent for execution. The MSIL code is translated
by JIT compiler.
• It provides an environment to run all the .NET Programs. The code which runs under the
CLR is called as Managed Code. Programmers need not to worry on managing the
memory if the programs are running under the CLR as it provides memory management
and thread management.
Unit 1. Overview of Microsoft .NET Framework
Execution in CLR
When the .NET program is compiled, the output of the compiler is not an executable file but a
file that constraints a special type of code is called Microsoft intermediate language , which is a
low level set of instructions understand by CLR.
• The MSIL defines a set of portable instructions that are CPU indendendent.
• It’s the job of the CLR to translate this MSIL into native code when the program is
executed, making the program to run in any environment for which the CLR is
implemented. And that’s how the .NET framework achieves Portability (run in any
environment). This MSIL is converts into Native code using JIT(Just In Time)compiler
• Types required for file I/O are members of the System.IO namespace. Namespaces
represent a logical concept.
• The FCL comprises hundreds of assemblies (DLLs), and each assembly may contain multiple
namespaces.
• Namespace is the Logical group of types (Class). We can say Namespace is a container (e.g.
Class, Structures, Interfaces, and Enumerations etc).
System.Data.SqlClient
System.Data.OleDb
System.Data.Odbc
System.IO Provides file and data stream I/O. These classes provide a way to access
the underlying file systems of the host operating system.
System.Windows.Forms Classes used to build Windows desktop GUI applications. Controls
including the ListBox, TextBox, DataGrid, and buttons are found here.
System.Xml Types for processing XML.
System.Web The Internet-related classes referred to as ASP.NET. They manage
browser-server communication requirements, manipulate cookies, and
contain the controls that adorn a Web page.
System.Web.Services Web.Services includes those classes required for SOAP-based XML
messaging.
Unit 1. Overview of Microsoft .NET Framework
It defines how types are declared, used, and managed in the common language runtime, and is
also an important part of the runtime's support for cross-language integration.
The common type system performs the following functions:
• Establishes a framework that helps enable cross-language integration, type safety, and
high-performance code execution.
• Provides an object-oriented model that supports the complete implementation of many
programming languages.
• Defines rules that languages must follow, which helps ensure that objects written in
different languages can interact with each other.
• Provides a library that contains the primitive data types (such
as Boolean, Byte, Char, Int32, and UInt64) used in application development.
For example, C# has an int data type and VB.NET has Integer data type. Hence a variable declared
as an int in C# and Integer in VB.NET, finally after compilation, uses the same structure Int32
from CTS.
Unit 1. Overview of Microsoft .NET Framework