SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Shri Shivaji Science College, Amravati
Department of Computer Science
Topic- .NET Framework
Prepared By
Dr. Ujwala S. Junghare
Dept. of Computer Science
Contents
• Structure of .NET
FRAMEWORK
• Components of .NET
FRAMEWORK
• The Common Type System (CTS)
•The Common Language Specification
(CLS)
•The Common Language Runtime (CLR)
.NET FRAMEWORK:
.NET Framework is ready to use collection of
classes and, interfaces and libraries for developing
particular type of application. Frameworks are
collection of reusable classes that present software
design and code that can be recycled for various
applications.
As shown in given diagram. NET framework sits on
the top of operating system. .NET is essentially a
system application that runs on windows.
Fig: .NET Framework Structure
• The most important component of Framework is CLR. CLR
activates objects, perform security checks on them, put them out
in the memory, executes them and garbage collect them.
• CLR is similar to JVM(Java Virtual Machine), JVM support to Java
language and the CLR support to all languages. JVM runs on
multiple platforms whereas .NET code runs on different Windows
platforms.
• On the top of CLR there is set of framework base classes, these set
of classes is similar to the classes in Java. These classes supports
elementary input output functionality, string manipulation,
security management , network communication, thread
management, text management , reflection and collection
functionality and other functionality.
• At the top of base classes there is a set of classes that support data
management and XML manipulation. Data classes support data
management which includes SQL, ADO.NET classes. .NET framework
support classes that manipulate XML data, perform XML searching
etc.
• There are classes in three different technologies such as web
services, web form and windows form. Web services include a
number of classes that supports to distributed components. These
components supports plug and play across cyberspace because it
uses HTTP and SOPE.
• Web Forms includes number of classes that allow you to develop
web graphical User Interface (GUI) applications.
• Windows Forms supports set of classes that allow you to develop
native windows GUI applications.
The following are key component of .NET
Framework:
• The Common Type System (CTS)
• The Common Language Specification (CLS)
• The Common Language Runtime (CLR)
The Common Type System (CTS)
The common type system is a formal definition of how all
type in the .net framework are connected, declared, used and
managed. .NET treats all language as equal therefore class
written in c# should same to class in vb.net etc. So to make
language integration , Microsoft specifies CTS.
CTS specify how type’s classes are reference and how
applications and class libraries are packaged for execution on
CLR. It defines class declaration, inheritance, referencing and
type management as .NET Framework.
CTS supply the following ground works for the .NET
framework:
• CTS provide the first class, pure object oriented model
supported by all programming languages.
• CTS establish the foundation and reference framework for
cross language integration, interoperation, type safety,
security and high performance code execution.
• CTS defines rule that languages must follow, which ensures
that objects written in different languages can interact with
each other.
Microsoft .NET support rich set of types but the important types are
value type, reference type, classes, interfaces and delegates.
• Value types: It represents the value allocated on stack. They can not be
null must contain some value. Values are passed by value to the function
it means that original value would not change. Value types includes
primitives, structure and enumeration.
• Reference Type: It includes object, interfaces and pointer. It contains
reference to the object and it can be null.
• Classes: CLR provides full support of OO concepts and class features such
as methods, fields, static members, visibility , nested type etc.
• Interfaces: It is exactly the same concept as C++ abstract base classes. An
interface may contain method , properties, events ,indexer. In .NET a class
can derived from multiple interfaces.
• Delegates: Microsoft .NET support type safe version of function pointer
called delegates.
Common Language Specification (CLS)
.NET is generally call “many language for one platform”.
We can construct classes and components that can be used by any
language and its respective IDEs and development tools, without
the need for complex COM and ActiveX interfaces and registration
details.
To achieve this, CLS requires that classes and component providers
should expose only the features that are common to all .NET
languages.
CLS is a subset of CTS (Common Type System). Main goal of .NET is
that program written in any language should interoperate with one
another taking advantage of inheritance, polymorphism etc.
However languages are not equal, they all have their own features
but Microsoft publish CLS to put all language on same sheet.
CLS specifies series of rules that are require for language integration
and interoperation. Due to this classes of one language can inherit in
other language, objects of one language can pass to other language.
So that maximum code can be reuse.
There are so many software development features such as general,
naming, types, types members, method, properties, event, pointers,
arrays, interfaces etc, these features must meet CLS compliance rules
and indicates whether the features applies to both developers and
compiler or only to compiler.
Common Language Runtime (CLR)
Visual Basic.NET applications, class libraries and components live
in two realities. One is design time reality and other is runtime
reality.
The design time reality is one where you design applications, write
source code, create classes and objects, debug and compile your
code. Run time reality is an external environment and this
environment is a Common Language Runtime mostly known as
CLR. The code that targets the CLR is called managed code. It
means that code execution in runtime environment is managed by
CLR.
The CLR is a hosted execution environment before it can
bootstrap on target platform, the CLR’s host must be supported
on that platform.
CLR activates objects, perform security check on them, put them
in memory executes them and garbage collect them.
There are many components in CLR as shown
below:
Fig: Major CLR components: the virtual execution system
As shown in figure at the top there is .NET PE (Portable
Executable) files layer and executes within CLR’s Virtual
Execution System which host the major component of
runtime. .NET PE files will have to go through class loader,
verifier, JIT compiler and other execution support
components before it executes.
Class loader loads the .NET classes in memory and prepare
them for execution. Verifier is a component that executes at
runtime to verify that code is type safe. JIT compiler converts
the IL code to native (object) code so that it can execute on
target operating system. Code manager uses managed data to
control the execution of code, also include exception
handling, security check, garbage collection and management
services.
For example: Code for “Hello World” in VB.NET
Imports System
Public Module modmain
Sub Main()
Console.WriteLine(“Hello World”)
End Sub
End Module
To compile this code use
vbc /t:exe /out:hello.exe hello.vb
Microsoft provide command line compiler, vbc, for VB.NET.
the /t option specify the type of PE file to be created. In this
case we have specified an EXE, hello.exe will be the output
of this command.
Fig: .Visual overview of CIL & CLR.
Intermediate Language (IL)/ MSIL:
When you compile your visual basic .NET source code, it is converted
into intermediate language (IL) so that CLR and other .NET development
environment can understand it. MSIL is a CPU-independent set of instructions that
can be efficiently converted to native code. All .NET languages compile code into
IL, which is known as Microsoft Intermediate Language MSIL or IL.
MSIL includes instructions for loading, storing, initializing, and calling
methods on objects, as well as instructions for arithmetic and logical operations,
control flow, direct memory access, exception handling, and other operations.
Once MSIL code is generated it packaged with its metadata in an assembly. Before
code can be executed, MSIL must be converted to CPU-specific code by a just in
time (JIT) compiler.
There are many advantages of IL such as compilation process is much
quicker because you don’t have to compile to machine code just to run debug
builds. Development environment of other .NET languages can use
components and class libraries from other languages because at IL level all
code is same.
There are some drawbacks of IL such as IL is not compile to machine
code so it can more easily be reverse engineered. As IL is further compile to
machine code, a small algorithm will require a direct unwrapped access to
system resources and hardware.
Assemblies:
Assembly is a physical container for at least one built executable or class file,
module component or icon. An assembly is a compiled code library used for
deployment, versioning and security. Assembly consists of one or more code modules.
Microsoft .Net Assembly is a logical unit of code, that contains code which the
Common Language Runtime (CLR) executes. It is the smallest unit of deployment of a
.net application and it can be a .dll or an exe .
An assembly is a grouping of files deployed as a single file. An assembly almost
always consists of at least two files: the executable and the manifest. The manifest is a
list of all the files that exist inside the assembly.
Assembly can be library or executable file. If the assembly is a library then the
class or classes are refereed by fully qualified namespace. If the assembly is an
executable file, an application which is referred by the name of physical file,
needs an entry point to allow OS to initiate its execution. For example if we
create an application called “welcome” then welcome.exe is an assembly.
We can separate assembly in four types,
Console executable: This assembly is standard and GUI less console window
file. Console assembly have .exe extension and it OS entry is through Main.
Windows executable: This assembly is standard .NET windows file and has .exe
extension and it OS entry is through WinMain.
Class library: This is standard .NET class library. These assembly have .DDL
extension and OS entry into the library is via DLLMain.
Class module: This is standard class module, which contains compiled class. It
has .netmodule extension.
Assembly can be of different nature such as static, dynamic, private
or shared.
Static assembly: This is a file created when you compile and
build class library.
Dynamic assembly: This is memory occupant module , which
allow you to access runtime type information.
Private assembly: It is access only by specific application.
Shared assembly: Any application can use it and dynamic
assembly can also be shared one.
Garbage Collection (Automatic memory management):
CLR support automatic memory management for all. NET
objects. The garbage collector (GC) is used when your objects are no
longer being referenced and performed garbage collection to recover the
unused memory.
Automatic memory management only frees resources held by outdated
objects. The finalization of objects in GC world of automatic memory
management is non-deterministic. It means you cannot predict exactly
when an object will remove from memory. Garbage collection can be
block then CLR controls GC.
CLR allows you some management over GC. The collection of GC
classes and methods are at your request. But you cannot force the
collection or make the cleanup deterministic. GC is very fast, so quickly it
disposes an object and frees its resources.
Namespaces:
Namespaces allow classes, structures and other items to be grouped
and organized and remove the possibility of class-naming conflicts.
As programming languages have progressed, the frameworks
around them have greatly increased in size.
The .NET framework provides a huge number of base classes, data
types, algorithms, etc. If every one of these items had to be
declared with a unique name, the naming task would be equally
large and would leave very few good names available for the .NET
developer.
To ensure that naming conflicts do not occur, either within the
.NET framework or in your own programs, namespaces are used.
A namespace simply provides a named group of classes,
structures, enumerations, delegates, interfaces and other
namespaces.
Within the namespace, all declared items must be uniquely
named. However, the same name may be duplicated in
different namespaces. This means that if you decide to
create a mathematics library you will be able to call it
“Math” even though Microsoft have also provided a Math
library.
The VB.Net Imports keyword is used to add a reference of a
namespace manually.
Namespaces are basically used to avoid naming collisions,
when we have multiple classes with the same name, and it is
also helpful for organizing classes libraries in a hierarchical
structure.
Namespaces allow us to organize Classes so that they can be
easily accessed in other applications. Namespaces also
enable reusability.
Example
1. Imports System
Note: Imports allow access to classes in the referenced Namespace
only not in its internal or child Namespaces. If we want to access
internal Namespace we might need to write:
1. Imports System.Collections
We can not build a VB.NET application without using classes from
the .NET System namespace. When we want to use a Windows
form, for example, you must use the System.Windows.Forms.Form
class. A button in a Windows form comes from the
System.Windows. Forms.Button class, and so on. There are many
such classes, organized into various namespaces like
System.Windows.Forms.
Here is an overview of some namespaces other than System and
System.Collections:
System.Data-Includes classes that make up ADO.NET. ADO.NET lets you build
data-handling components that manage data from multiple distributed data
sources.
System.Data.OleDb-Includes classes that support the OLE DB .NET data
provider.
System.Data.SqlClient-Includes classes that support the SQL Server .NET data
provider.
System.Diagnostics-Includes classes that allow you to debug your application
and to step through your code. Also includes code to start system processes,
read and write to event logs, and monitor system performance.
System.Drawing-Provides access to the GDI+ graphics packages that give you
access to drawing methods.
System.Drawing.Drawing2D-Includes classes that support advanced two
dimensional and vector graphics.
System.Drawing.Imaging-Includes classes that support advanced GDI+imaging.
System.Drawing.Printing-Includes classes that allow you to
customize and perform printing.
System.Drawing.Text-Includes classes that support advanced
GDI+typography operations. The classes in this namespace allow
users to create and use collections of fonts.
System.Globalization-Includes classes that specify culture-related
information, including the language, the country/region, calendars,
the format patterns for dates, currency and numbers, the sort order
for strings, and so on.
System.IO-Includes types that support synchronous and
asynchronous reading from and writing to both data streams and
files.
System.Net-Provides an interface to many of the protocols used on
the Internet.
System.Net.Sockets-Includes classes that support the Windows
Sockets interface. If you have worked with the Winsock API, you
should be able to develop applications using the Socket class.
System.Reflection-Includes classes and interfaces that return information
about types, methods, and fields, and also have the ability to dynamically
create and invoke types.
System.Security-Includes classes that support the structure of the common
language runtime security system.
System.Threading-Includes classes and interfaces that enable
multithreaded programming.
System.Web-Includes classes and interfaces that support browser/server
communication.Included in this namespace are the HTTPRequest class that
provides information about HTTP requests, the HTTPResponse class that
manages HTTP output to the client, and the HTTPServerUtility class that
provides access to server-side utilities and processes. You can also use
cookies, support file transfer, and more with these classes.
System.Web.Security-Includes classes that are used to implement
ASP.NET security in Web server applications.
System.Web.Services-Includes classes that let you build and use Web
services, programmable entities on Web Server that code can communicate
with using standard Internet protocols.
System.Windows.Forms-Includes classes for creating Windows-based
forms that make use of the user interface controls and other features
available in the Windows operating system.
System.Xml-Includes classes that support processing of XML.
The End to DLL Hell:
Dll Hell refers to a set of problems caused when multiple applications attempt
to share a common component like a dynamic link library (DLL).
For example before some time, if we install an application then dll of that
application get stored in the registry, then if we install other application that
has same name .dll that means previously installed .dll get overwrite by the
same name new .dll. Ok for newly installed application but previously installed
application can’t get execute further. This is big problem in context of version of
same application. This is Dell-Hell problem.
This problem of dynamic link library (.dll) is resolved through Versioning.
Versioning is the technique to provide version to the .dll to prevent them
from replacement. GAC (Global assembly cache) is the separate memory like
cache it is used to remove load form operating system.
In .NET as long as you keep the old component around, the application can
still reference it. Newer version of the component can be install to the
machine as needed by the newer application. Therefore you don’t need to
register the DLL and components.
To add version in assembly just write in Program :
Managed Execution:
.NET just-in-time compiler has been engineered to preserve both
memory and resources while giving maximum throughput.
Whenever code needs to be compiled immediately, the function JIT
compilation is done.
Managed execution is not a single process but it is stack of many
operations. The following list is a reduced stack that represents
beginning to end of .NET application:
1. Code is generated by developer.
2. Code is compiled to MIL.
3. Code is described with metadata and gathered into an assembly.
4. Code check prior to execution (To make sure nothing malicious
has been included).
Managed execution also describe what the CLR does once it
has loaded and executed an application. Three sophisticated
operations on CLR that influence application design and
construction are side by side execution, garbage collection
and isolation of application.
5. Code is JIT compiled (convert MSIL code to CPU specific
code).
6. Code is executed.
7. Code execution is managed (GC management)
8. Code is terminated and resources are freed.

Weitere ähnliche Inhalte

Was ist angesagt?

Microsoft dot net framework
Microsoft dot net frameworkMicrosoft dot net framework
Microsoft dot net framework
Ashish Verma
 
Net Fundamentals
Net FundamentalsNet Fundamentals
Net Fundamentals
Ali Taki
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
Nitu Pandey
 
.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
Doncho Minkov
 
.Net framework
.Net framework.Net framework
.Net framework
Arun Pal
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net Fundamentals
LiquidHub
 
Java vs .net
Java vs .netJava vs .net
Java vs .net
Tech_MX
 

Was ist angesagt? (20)

.Net framework components by naveen kumar veligeti
.Net framework components by naveen kumar veligeti.Net framework components by naveen kumar veligeti
.Net framework components by naveen kumar veligeti
 
.Net framework
.Net framework.Net framework
.Net framework
 
1.Philosophy of .NET
1.Philosophy of .NET1.Philosophy of .NET
1.Philosophy of .NET
 
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
 
Introduction to ,NET Framework
Introduction to ,NET FrameworkIntroduction to ,NET Framework
Introduction to ,NET Framework
 
Introductionto .netframework by Priyanka Pinglikar
Introductionto .netframework by Priyanka PinglikarIntroductionto .netframework by Priyanka Pinglikar
Introductionto .netframework by Priyanka Pinglikar
 
Microsoft dot net framework
Microsoft dot net frameworkMicrosoft dot net framework
Microsoft dot net framework
 
Net Fundamentals
Net FundamentalsNet Fundamentals
Net Fundamentals
 
Introduction to .net
Introduction to .netIntroduction to .net
Introduction to .net
 
.Net Framework Introduction
.Net Framework Introduction.Net Framework Introduction
.Net Framework Introduction
 
Intro.net
Intro.netIntro.net
Intro.net
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
 
Architecture of net framework
Architecture of net frameworkArchitecture of net framework
Architecture of net framework
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
 
.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
 
.Net framework
.Net framework.Net framework
.Net framework
 
Microsoft.Net
Microsoft.NetMicrosoft.Net
Microsoft.Net
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net Fundamentals
 
Dotnet1
Dotnet1Dotnet1
Dotnet1
 
Java vs .net
Java vs .netJava vs .net
Java vs .net
 

Ähnlich wie Session2 (3)

Dotnet interview qa
Dotnet interview qaDotnet interview qa
Dotnet interview qa
abcxyzqaz
 
.NET TECHNOLOGIES
.NET TECHNOLOGIES.NET TECHNOLOGIES
.NET TECHNOLOGIES
Prof Ansari
 
.Net framework
.Net framework.Net framework
.Net framework
Raghu nath
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questions
Mir Majid
 

Ähnlich wie Session2 (3) (20)

.Net framework
.Net framework.Net framework
.Net framework
 
Dot net
Dot netDot net
Dot net
 
Chapter1_Part1.pptx
Chapter1_Part1.pptxChapter1_Part1.pptx
Chapter1_Part1.pptx
 
Chapter 1 introduction to .net
Chapter 1 introduction to .netChapter 1 introduction to .net
Chapter 1 introduction to .net
 
Unit I- Introduction to .NET Framework.pdf
Unit I- Introduction to .NET Framework.pdfUnit I- Introduction to .NET Framework.pdf
Unit I- Introduction to .NET Framework.pdf
 
Dotnet interview qa
Dotnet interview qaDotnet interview qa
Dotnet interview qa
 
.Net Session Overview
.Net Session Overview.Net Session Overview
.Net Session Overview
 
.Net overview|Introduction Of .net
.Net overview|Introduction Of .net.Net overview|Introduction Of .net
.Net overview|Introduction Of .net
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
 
1 what is microsoft .net framework
1 what is microsoft .net framework1 what is microsoft .net framework
1 what is microsoft .net framework
 
.NET TECHNOLOGIES
.NET TECHNOLOGIES.NET TECHNOLOGIES
.NET TECHNOLOGIES
 
1.0
1.01.0
1.0
 
c#.pptx
c#.pptxc#.pptx
c#.pptx
 
.Net framework
.Net framework.Net framework
.Net framework
 
.Net framework
.Net framework.Net framework
.Net framework
 
Web technology slideshare
Web technology slideshareWeb technology slideshare
Web technology slideshare
 
Net framework
 Net framework Net framework
Net framework
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questions
 
.Net platform an understanding
.Net platform an understanding.Net platform an understanding
.Net platform an understanding
 

Kürzlich hochgeladen

Conjugation, transduction and transformation
Conjugation, transduction and transformationConjugation, transduction and transformation
Conjugation, transduction and transformation
Areesha Ahmad
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
MohamedFarag457087
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
levieagacer
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsBiogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Sérgio Sacani
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and Classifications
Areesha Ahmad
 

Kürzlich hochgeladen (20)

Molecular markers- RFLP, RAPD, AFLP, SNP etc.
Molecular markers- RFLP, RAPD, AFLP, SNP etc.Molecular markers- RFLP, RAPD, AFLP, SNP etc.
Molecular markers- RFLP, RAPD, AFLP, SNP etc.
 
Conjugation, transduction and transformation
Conjugation, transduction and transformationConjugation, transduction and transformation
Conjugation, transduction and transformation
 
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
 
An introduction on sequence tagged site mapping
An introduction on sequence tagged site mappingAn introduction on sequence tagged site mapping
An introduction on sequence tagged site mapping
 
Digital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptxDigital Dentistry.Digital Dentistryvv.pptx
Digital Dentistry.Digital Dentistryvv.pptx
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptxClimate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
Grade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its FunctionsGrade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its Functions
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsBiogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
 
COMPUTING ANTI-DERIVATIVES (Integration by SUBSTITUTION)
COMPUTING ANTI-DERIVATIVES(Integration by SUBSTITUTION)COMPUTING ANTI-DERIVATIVES(Integration by SUBSTITUTION)
COMPUTING ANTI-DERIVATIVES (Integration by SUBSTITUTION)
 
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and Classifications
 
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate ProfessorThyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
 
Proteomics: types, protein profiling steps etc.
Proteomics: types, protein profiling steps etc.Proteomics: types, protein profiling steps etc.
Proteomics: types, protein profiling steps etc.
 
Clean In Place(CIP).pptx .
Clean In Place(CIP).pptx                 .Clean In Place(CIP).pptx                 .
Clean In Place(CIP).pptx .
 
Velocity and Acceleration PowerPoint.ppt
Velocity and Acceleration PowerPoint.pptVelocity and Acceleration PowerPoint.ppt
Velocity and Acceleration PowerPoint.ppt
 

Session2 (3)

  • 1. Shri Shivaji Science College, Amravati Department of Computer Science Topic- .NET Framework Prepared By Dr. Ujwala S. Junghare Dept. of Computer Science
  • 2. Contents • Structure of .NET FRAMEWORK • Components of .NET FRAMEWORK • The Common Type System (CTS) •The Common Language Specification (CLS) •The Common Language Runtime (CLR)
  • 3. .NET FRAMEWORK: .NET Framework is ready to use collection of classes and, interfaces and libraries for developing particular type of application. Frameworks are collection of reusable classes that present software design and code that can be recycled for various applications. As shown in given diagram. NET framework sits on the top of operating system. .NET is essentially a system application that runs on windows.
  • 5. • The most important component of Framework is CLR. CLR activates objects, perform security checks on them, put them out in the memory, executes them and garbage collect them. • CLR is similar to JVM(Java Virtual Machine), JVM support to Java language and the CLR support to all languages. JVM runs on multiple platforms whereas .NET code runs on different Windows platforms. • On the top of CLR there is set of framework base classes, these set of classes is similar to the classes in Java. These classes supports elementary input output functionality, string manipulation, security management , network communication, thread management, text management , reflection and collection functionality and other functionality.
  • 6. • At the top of base classes there is a set of classes that support data management and XML manipulation. Data classes support data management which includes SQL, ADO.NET classes. .NET framework support classes that manipulate XML data, perform XML searching etc. • There are classes in three different technologies such as web services, web form and windows form. Web services include a number of classes that supports to distributed components. These components supports plug and play across cyberspace because it uses HTTP and SOPE. • Web Forms includes number of classes that allow you to develop web graphical User Interface (GUI) applications. • Windows Forms supports set of classes that allow you to develop native windows GUI applications.
  • 7. The following are key component of .NET Framework: • The Common Type System (CTS) • The Common Language Specification (CLS) • The Common Language Runtime (CLR)
  • 8. The Common Type System (CTS) The common type system is a formal definition of how all type in the .net framework are connected, declared, used and managed. .NET treats all language as equal therefore class written in c# should same to class in vb.net etc. So to make language integration , Microsoft specifies CTS. CTS specify how type’s classes are reference and how applications and class libraries are packaged for execution on CLR. It defines class declaration, inheritance, referencing and type management as .NET Framework.
  • 9. CTS supply the following ground works for the .NET framework: • CTS provide the first class, pure object oriented model supported by all programming languages. • CTS establish the foundation and reference framework for cross language integration, interoperation, type safety, security and high performance code execution. • CTS defines rule that languages must follow, which ensures that objects written in different languages can interact with each other.
  • 10. Microsoft .NET support rich set of types but the important types are value type, reference type, classes, interfaces and delegates. • Value types: It represents the value allocated on stack. They can not be null must contain some value. Values are passed by value to the function it means that original value would not change. Value types includes primitives, structure and enumeration. • Reference Type: It includes object, interfaces and pointer. It contains reference to the object and it can be null. • Classes: CLR provides full support of OO concepts and class features such as methods, fields, static members, visibility , nested type etc. • Interfaces: It is exactly the same concept as C++ abstract base classes. An interface may contain method , properties, events ,indexer. In .NET a class can derived from multiple interfaces. • Delegates: Microsoft .NET support type safe version of function pointer called delegates.
  • 11. Common Language Specification (CLS) .NET is generally call “many language for one platform”. We can construct classes and components that can be used by any language and its respective IDEs and development tools, without the need for complex COM and ActiveX interfaces and registration details. To achieve this, CLS requires that classes and component providers should expose only the features that are common to all .NET languages. CLS is a subset of CTS (Common Type System). Main goal of .NET is that program written in any language should interoperate with one another taking advantage of inheritance, polymorphism etc.
  • 12. However languages are not equal, they all have their own features but Microsoft publish CLS to put all language on same sheet. CLS specifies series of rules that are require for language integration and interoperation. Due to this classes of one language can inherit in other language, objects of one language can pass to other language. So that maximum code can be reuse. There are so many software development features such as general, naming, types, types members, method, properties, event, pointers, arrays, interfaces etc, these features must meet CLS compliance rules and indicates whether the features applies to both developers and compiler or only to compiler.
  • 13. Common Language Runtime (CLR) Visual Basic.NET applications, class libraries and components live in two realities. One is design time reality and other is runtime reality. The design time reality is one where you design applications, write source code, create classes and objects, debug and compile your code. Run time reality is an external environment and this environment is a Common Language Runtime mostly known as CLR. The code that targets the CLR is called managed code. It means that code execution in runtime environment is managed by CLR. The CLR is a hosted execution environment before it can bootstrap on target platform, the CLR’s host must be supported on that platform. CLR activates objects, perform security check on them, put them in memory executes them and garbage collect them.
  • 14. There are many components in CLR as shown below: Fig: Major CLR components: the virtual execution system
  • 15. As shown in figure at the top there is .NET PE (Portable Executable) files layer and executes within CLR’s Virtual Execution System which host the major component of runtime. .NET PE files will have to go through class loader, verifier, JIT compiler and other execution support components before it executes. Class loader loads the .NET classes in memory and prepare them for execution. Verifier is a component that executes at runtime to verify that code is type safe. JIT compiler converts the IL code to native (object) code so that it can execute on target operating system. Code manager uses managed data to control the execution of code, also include exception handling, security check, garbage collection and management services.
  • 16. For example: Code for “Hello World” in VB.NET Imports System Public Module modmain Sub Main() Console.WriteLine(“Hello World”) End Sub End Module To compile this code use vbc /t:exe /out:hello.exe hello.vb Microsoft provide command line compiler, vbc, for VB.NET. the /t option specify the type of PE file to be created. In this case we have specified an EXE, hello.exe will be the output of this command.
  • 17. Fig: .Visual overview of CIL & CLR.
  • 18. Intermediate Language (IL)/ MSIL: When you compile your visual basic .NET source code, it is converted into intermediate language (IL) so that CLR and other .NET development environment can understand it. MSIL is a CPU-independent set of instructions that can be efficiently converted to native code. All .NET languages compile code into IL, which is known as Microsoft Intermediate Language MSIL or IL. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Once MSIL code is generated it packaged with its metadata in an assembly. Before code can be executed, MSIL must be converted to CPU-specific code by a just in time (JIT) compiler.
  • 19. There are many advantages of IL such as compilation process is much quicker because you don’t have to compile to machine code just to run debug builds. Development environment of other .NET languages can use components and class libraries from other languages because at IL level all code is same. There are some drawbacks of IL such as IL is not compile to machine code so it can more easily be reverse engineered. As IL is further compile to machine code, a small algorithm will require a direct unwrapped access to system resources and hardware.
  • 20. Assemblies: Assembly is a physical container for at least one built executable or class file, module component or icon. An assembly is a compiled code library used for deployment, versioning and security. Assembly consists of one or more code modules. Microsoft .Net Assembly is a logical unit of code, that contains code which the Common Language Runtime (CLR) executes. It is the smallest unit of deployment of a .net application and it can be a .dll or an exe . An assembly is a grouping of files deployed as a single file. An assembly almost always consists of at least two files: the executable and the manifest. The manifest is a list of all the files that exist inside the assembly.
  • 21. Assembly can be library or executable file. If the assembly is a library then the class or classes are refereed by fully qualified namespace. If the assembly is an executable file, an application which is referred by the name of physical file, needs an entry point to allow OS to initiate its execution. For example if we create an application called “welcome” then welcome.exe is an assembly. We can separate assembly in four types, Console executable: This assembly is standard and GUI less console window file. Console assembly have .exe extension and it OS entry is through Main. Windows executable: This assembly is standard .NET windows file and has .exe extension and it OS entry is through WinMain. Class library: This is standard .NET class library. These assembly have .DDL extension and OS entry into the library is via DLLMain. Class module: This is standard class module, which contains compiled class. It has .netmodule extension.
  • 22. Assembly can be of different nature such as static, dynamic, private or shared. Static assembly: This is a file created when you compile and build class library. Dynamic assembly: This is memory occupant module , which allow you to access runtime type information. Private assembly: It is access only by specific application. Shared assembly: Any application can use it and dynamic assembly can also be shared one.
  • 23. Garbage Collection (Automatic memory management): CLR support automatic memory management for all. NET objects. The garbage collector (GC) is used when your objects are no longer being referenced and performed garbage collection to recover the unused memory. Automatic memory management only frees resources held by outdated objects. The finalization of objects in GC world of automatic memory management is non-deterministic. It means you cannot predict exactly when an object will remove from memory. Garbage collection can be block then CLR controls GC. CLR allows you some management over GC. The collection of GC classes and methods are at your request. But you cannot force the collection or make the cleanup deterministic. GC is very fast, so quickly it disposes an object and frees its resources.
  • 24. Namespaces: Namespaces allow classes, structures and other items to be grouped and organized and remove the possibility of class-naming conflicts. As programming languages have progressed, the frameworks around them have greatly increased in size. The .NET framework provides a huge number of base classes, data types, algorithms, etc. If every one of these items had to be declared with a unique name, the naming task would be equally large and would leave very few good names available for the .NET developer. To ensure that naming conflicts do not occur, either within the .NET framework or in your own programs, namespaces are used.
  • 25. A namespace simply provides a named group of classes, structures, enumerations, delegates, interfaces and other namespaces. Within the namespace, all declared items must be uniquely named. However, the same name may be duplicated in different namespaces. This means that if you decide to create a mathematics library you will be able to call it “Math” even though Microsoft have also provided a Math library. The VB.Net Imports keyword is used to add a reference of a namespace manually.
  • 26. Namespaces are basically used to avoid naming collisions, when we have multiple classes with the same name, and it is also helpful for organizing classes libraries in a hierarchical structure. Namespaces allow us to organize Classes so that they can be easily accessed in other applications. Namespaces also enable reusability.
  • 27. Example 1. Imports System Note: Imports allow access to classes in the referenced Namespace only not in its internal or child Namespaces. If we want to access internal Namespace we might need to write: 1. Imports System.Collections We can not build a VB.NET application without using classes from the .NET System namespace. When we want to use a Windows form, for example, you must use the System.Windows.Forms.Form class. A button in a Windows form comes from the System.Windows. Forms.Button class, and so on. There are many such classes, organized into various namespaces like System.Windows.Forms.
  • 28. Here is an overview of some namespaces other than System and System.Collections: System.Data-Includes classes that make up ADO.NET. ADO.NET lets you build data-handling components that manage data from multiple distributed data sources. System.Data.OleDb-Includes classes that support the OLE DB .NET data provider. System.Data.SqlClient-Includes classes that support the SQL Server .NET data provider. System.Diagnostics-Includes classes that allow you to debug your application and to step through your code. Also includes code to start system processes, read and write to event logs, and monitor system performance. System.Drawing-Provides access to the GDI+ graphics packages that give you access to drawing methods. System.Drawing.Drawing2D-Includes classes that support advanced two dimensional and vector graphics. System.Drawing.Imaging-Includes classes that support advanced GDI+imaging.
  • 29. System.Drawing.Printing-Includes classes that allow you to customize and perform printing. System.Drawing.Text-Includes classes that support advanced GDI+typography operations. The classes in this namespace allow users to create and use collections of fonts. System.Globalization-Includes classes that specify culture-related information, including the language, the country/region, calendars, the format patterns for dates, currency and numbers, the sort order for strings, and so on. System.IO-Includes types that support synchronous and asynchronous reading from and writing to both data streams and files. System.Net-Provides an interface to many of the protocols used on the Internet. System.Net.Sockets-Includes classes that support the Windows Sockets interface. If you have worked with the Winsock API, you should be able to develop applications using the Socket class.
  • 30. System.Reflection-Includes classes and interfaces that return information about types, methods, and fields, and also have the ability to dynamically create and invoke types. System.Security-Includes classes that support the structure of the common language runtime security system. System.Threading-Includes classes and interfaces that enable multithreaded programming. System.Web-Includes classes and interfaces that support browser/server communication.Included in this namespace are the HTTPRequest class that provides information about HTTP requests, the HTTPResponse class that manages HTTP output to the client, and the HTTPServerUtility class that provides access to server-side utilities and processes. You can also use cookies, support file transfer, and more with these classes. System.Web.Security-Includes classes that are used to implement ASP.NET security in Web server applications. System.Web.Services-Includes classes that let you build and use Web services, programmable entities on Web Server that code can communicate with using standard Internet protocols. System.Windows.Forms-Includes classes for creating Windows-based forms that make use of the user interface controls and other features available in the Windows operating system. System.Xml-Includes classes that support processing of XML.
  • 31. The End to DLL Hell: Dll Hell refers to a set of problems caused when multiple applications attempt to share a common component like a dynamic link library (DLL). For example before some time, if we install an application then dll of that application get stored in the registry, then if we install other application that has same name .dll that means previously installed .dll get overwrite by the same name new .dll. Ok for newly installed application but previously installed application can’t get execute further. This is big problem in context of version of same application. This is Dell-Hell problem.
  • 32. This problem of dynamic link library (.dll) is resolved through Versioning. Versioning is the technique to provide version to the .dll to prevent them from replacement. GAC (Global assembly cache) is the separate memory like cache it is used to remove load form operating system. In .NET as long as you keep the old component around, the application can still reference it. Newer version of the component can be install to the machine as needed by the newer application. Therefore you don’t need to register the DLL and components. To add version in assembly just write in Program :
  • 33. Managed Execution: .NET just-in-time compiler has been engineered to preserve both memory and resources while giving maximum throughput. Whenever code needs to be compiled immediately, the function JIT compilation is done. Managed execution is not a single process but it is stack of many operations. The following list is a reduced stack that represents beginning to end of .NET application: 1. Code is generated by developer. 2. Code is compiled to MIL. 3. Code is described with metadata and gathered into an assembly. 4. Code check prior to execution (To make sure nothing malicious has been included).
  • 34. Managed execution also describe what the CLR does once it has loaded and executed an application. Three sophisticated operations on CLR that influence application design and construction are side by side execution, garbage collection and isolation of application. 5. Code is JIT compiled (convert MSIL code to CPU specific code). 6. Code is executed. 7. Code execution is managed (GC management) 8. Code is terminated and resources are freed.