Professional Documents
Culture Documents
Unit 1 Theory Material
Unit 1 Theory Material
.Net Framework
Answer:-
Figures:-.NET Framework
1|Page
The framework offers a fundamental shift in Microsoft strategy: it moves
application development from client-centric to server-centric
Definition:
The CLR stands for “common language runtime” which is the run
time engine & execution environment. For any .Net application and
it is responsible for translating MSIL code into native code.
o Access to metadata
2|Page
o
J#.Net languages
Language Language
compiler compiler
JSC.exe
Step-2:- Compiler
Step-3:- JIT
The JIT “Just In time compiler” translate the MSIL code into native code.
Step-4:-
At last the native code will be execute and we can get output according
to our source code.
Features of CLR:-
Code verification.
Security management.
Garbage collection.
4|Page
Common Type System(CTS):-
Definition:-
The CTS stands “common type system” which is used to declare manages and
use of multiple no. of data. Types for cross language integration, type
safety and improved execution performance.
Languages must agree on the meanings of these concepts before they can
integrate with one another.
CLS forms a subset of CTS. This implies that all the rules that apply to
CTS apply to CLS also.
1. Value types
2. Reference types
1. Value types
Example: int a;
2. Reference types
5|Page
Example: SqlConnection cnn = new SqlConnection();
According to above figure, we can use integer data type in c#.net as int i;
and we can use integer data type like Dim i as integer; and at run time this
are converted into common data type as system.int32 i ; by using CTS.
Assembly:-
6|Page
An Assembly is a logical DLL.
All managed types and resources are marked either as accessible only within
their implementation unit or as accessible by code outside that unit.
Assembly:
The assembly is a set of exe or .dll file & it is a basic building block or
deployment unit which contains MSIL code, Manifest file, type metadata,
resource file.
7|Page
ILDASM (“Intermediate Dissembler”) command is used to view the
content of assembly (MSIL) file.
Element/Structure of Assembly:-
i) MSIL code:-
The JIT compiler compile & convert this MSIL code into native code
for execution.
ii) Manifest:-
The type metadata file contain the information about the list of data
type variables, properties, method used in MSIL code
The resource file contain the information about text file, icon files,
images, sound or video file which can be used in MSIL code.
8|Page
MSIL
Manifest
(console application)
Type metadata
Resource file
9|Page
Metadata:-
A .NET language compiler will generate the metadata and store this in
the assembly.
The header section of every .NET PE file contains a special new section
for Metadata.
Locate classes
Load classes
Providing security
In C, <conio.h>, <stdio.h> etc. are header files. We add those header files
in our program to use inbuilt functions.
10 | P a g e
The class library consists of data classes, XML classes, Web Forms classes
and Windows Forms classes, Smart devices classes, Input Output classes.
Name Space:-
When the paymaster stands and calls out the names of people to receive
their salary, the GM Chauhan Vijay won’t be happy if he rushes to the table
when the paymaster calls out his name and the envelope contains the
Tester Chauhan Vijay salary only 10,000.
11 | P a g e
To resolve the naming ambiguity, the reliance Industry can simply define
three Namespace: Executive, General Manager and Tester. Now the three
individuals can be unambiguously referred to by their fully qualified
names:
Executive.Chauhan Vijay
Tester.Chauhan Vijay
Same like above Namespace provide scope: Two classes have the same
name but they should reside in different Namespace.
Basically there are two types of Namespace: inbuilt and user define.
Step 2:- Select compiler of programming language, for VB.NET select VBC, fir
(MSIL) (CIL) (IL) and converting your source code into MSIL and
Step 5:- JIT compiler translates the MSIL into native code
Definition:
MSIL is the CPU independent instruction set into which .NET Framework
programs are compiled.
Combined with metadata and the common type system, MSIL allows for
true cross language integration.
JIT:-
Definition:-
13 | P a g e
JIT stands for “Just In Time Compiler” which is responsible to
translate MSIL code to native code.
JIT does not compile whole program each time and every time. It compiles
only that portion of the program which functions are called that time and
suppose Native code is already present then that data will not again compiled.
If changes are made then possible that it will again generates MSIL to Naive.
Firstly any program compile by its own compiler then it will convert into MSIL
then with the help of JIT;MSIL compile into Native code but CLR does not
convert whole MSIL code to Native code on load time of that application;
instead of it compiles the MSIL instructions as they are called.
Types of JIT:-
Pre-JIT:-
Econo-JIT:-
Normal-JIT:-
The normal JIT compiler convert only those method which are
called at run time from MSIL code to native code and store its
native code into cache memory for reusability.
Managed Code:-
14 | P a g e
Code that targets the common language runtime, the framework, is known
as managed code.
The source code which is written using any .NET supported & run or
executes under the environment of .NET Framework runtime engine
“CLR” and get all the features provide by the CLR such as MSIL to native
conversion, garbage collection & memory management.
Example:-
Unmanaged Code:-
Code that does not targets the common language runtime is known as
unmanaged code.
Unmanaged code is what you use to make before Visual Basic .NET 2002
released.
The source code which is not written in .NET supported language and dose
not execute under the environment of .NET runtime engine “CLR” and does
not get feature provide by CLR is called Unmanaged code.
Example:-
Managed Code:-
15 | P a g e
1. Understandable by CLR.
Unmanaged Code:-
About C#:-
1. Singleline using //
2. Multiline using /* */
16 | P a g e
Differentiate: Value Type v/s Reference Type:-
Value Type:
The value type data are stored using stack data structure into the
memory.
The value type data access is faster with compare to reference type
because it is stored using stack data
Example:-
Int
Char
Unions
Structure
Boolean
Enumeration
All the value type derived from System.valuetype variable then it will not
affect the values of other variables.
Reference Type:-
The reference type variable can store the reference (address) of other
variables.
The reference type data are stored using heap data structure into the
memory.
The reference type data access is slower with compare to value type
because it is stored using heap data structure.
Example:-
17 | P a g e
Object
Class
Interface
Delegate
Array
If we change the value of any reference type variable then it will affect
the values of other variables.
Boxing:-
The translation from value type to reference type data is called boxing.
Example:
Unboxing:-
The translation from reference type to value type data is called Unboxing.
Example:-
unboxing
18 | P a g e