0% found this document useful (0 votes)
59 views

By Nimesh Kumar Dagur, CDAC, India

The .NET Framework is a development platform created by Microsoft that allows programmers to build applications for Windows, as well as web applications and web services. It includes a common language runtime (CLR) that handles running applications and a class library that contains pre-built functionality. The .NET Framework supports multiple programming languages and provides benefits like consistent programming models, cross-platform support, and automatic resource management. It allows developers to build various types of applications using Visual Studio and languages like C#.

Uploaded by

Manel
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

By Nimesh Kumar Dagur, CDAC, India

The .NET Framework is a development platform created by Microsoft that allows programmers to build applications for Windows, as well as web applications and web services. It includes a common language runtime (CLR) that handles running applications and a class library that contains pre-built functionality. The .NET Framework supports multiple programming languages and provides benefits like consistent programming models, cross-platform support, and automatic resource management. It allows developers to build various types of applications using Visual Studio and languages like C#.

Uploaded by

Manel
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 62

Introduction to .

NET Framework

By Nimesh Kumar Dagur,CDAC,India


Topics
• What is the .NET Framework?
• What is the .NET Framework Architecture?
• How .NET applications work?
• What is C# and how it relates to the .NET Framework
• Tools available for creating .NET applications with C#
WHAT IS THE .NET FRAMEWORK?
• The .NET Framework (version 4.5) is a revolutionary platform created by Microsoft
for developing applications.
• It consists of the common language runtime (CLR) which is the execution engine that
handles running applications and the .NET Framework class library, which includes
classes, interfaces, and value types that support an extensive range of technologies.
• With .NET framework, Microsoft has provided programmers a single platform for
developing applications using different programming languages such as VB,C#,VC++.
• The .NET Framework is really a cluster of several technologies:

 The .NET languages: Visual Basic, C#, F#, and C++

 The Common Language Runtime (CLR): This is the engine that executes all .NET
programs and provides automatic services for these applications, such as security
checking, memory management, and optimization.
WHAT IS THE .NET FRAMEWORK?

 The .NET Framework class library: The class library collects


thousands of pieces of prebuilt functionality that you can
“snap in” to your applications.
 These features are sometimes organized into technology sets,
such as ADO.NET (the technology for creating database
applications) and Windows Presentation Foundation (WPF,
the technology for creating desktop user interfaces).
WHAT IS THE .NET FRAMEWORK?

 ASP.NET: This is the engine that hosts the web applications


you create with .NET, and supports almost any feature from
the .NET Framework class library.
 ASP.NET also includes a set of web-specific services, such as
secure authentication and data storage.
WHAT IS THE .NET FRAMEWORK?

 Visual Studio: To enable developers to use the features and


services offered by the .NET framework Microsoft introduced
a development and execution software called Visual Studio.
 It provides a comprehensive and integrated environment for
developing applications that use the features and services
provided by .NET Framework.
 It allows you to develop various types of applications, such as
Console applications, Windows form applications, web
applications and web services in any of the .NET languages
such as vb, C#, VC++.
 Visual Studio includes the complete .NET Framework, so you
won’t need to download it separately.
Benefits of .NET Framework

• Consistent Programming model


• Cross platform support
• Language interoperability
• Automatic Management of Resources
• Ease of deployment
.NET Framework 4.5 Architecture

• .NET Framework 4.5 at its core consists of:


 Common Language Runtime (CLR),
 Dynamic Language Runtime (DLR),
 Base Class Library (BCL),
 Portable Class Library,
.NET Framework 4.5 Architecture
Components of .NET Framework 4.5 Architecture -
Common Language Runtime (CLR)

• CLR is responsible for the execution of all applications


developed using the .NET library.
Components of .NET Framework 4.5 Architecture -
Base Class Library (BCL)

• This is a library of functionalities which are available to all


languages using the .NET Framework.
• It consists of classes, interfaces of reusable types that
integrates with CLR
Components of .NET Framework 4.5 Architecture –
Portable Class Library

• The Portable Class Library project in Visual Studio 2012 allows


you to develop and build managed assemblies that work on
multiple .NET Framework platforms.
• Using a Portable Class Library project, you choose the
platforms (such as Windows Phone and .NET for Windows
Store apps) to target.
Components of .NET Framework 4.5 Architecture -
Dynamic Language Runtime

• This provides the runtime environment for dynamic languages


like python etc. for executing under the full control of CLR.
Components of .NET Framework 4.5 Architecture -
Asp.Net

• This is used to build rich internet based web application.


Components of .NET Framework 4.5 Architecture - Windows Store
Apps (Metro Style Apps)

• A Windows Store app is a new type of application that runs on


Windows 8 devices and can take advantage of new WinRT
APIs.
• These can only be distributed in the Windows 8 store
Components of .NET Framework 4.5 Architecture -
Desktop Apps (Windows Forms)

• A Windows Desktop app is traditional Windows Forms


application with a new name.
• Software developed for Windows XP, Windows Vista and
Windows 7 will be categorized as a Windows Desktop app
when running in Windows 8.
• Examples of Windows Desktop apps are Microsoft Office
families products, notepad etc
Components of .NET Framework 4.5 Architecture -
WPF

• WPF is used to create applications with a rich user experience.


• It includes application UI, 2D graphics, 3D graphics and
multimedia.
• It takes advantage of hardware acceleration of modern
graphic cards.
• WPF makes the UI faster, scalable and resolution
independent.
Components of .NET Framework 4.5 Architecture -
Silver Light

• This is a cross-browser web based technology which allows


designers and developers to deliver Rich Internet Applications
(RIA) embedded in Web pages.
Components of .NET Framework 4.5 Architecture -
Ado.Net

• This is used to create Data Access Layer to query and


manipulate data from underlying data source like SQL Server,
Oracle, and DB2 etc.
Components of .NET Framework 4.5 Architecture -
LINQ

• This allows you to query the data from the various data
sources (like SQL databases, XML documents, Ado.Net
Datasets, Various Web services and any other objects such as
Collections, Generics etc.) using a SQL Query like syntax
with .Net framework languages like C# and VB.
Components of .NET Framework 4.5 Architecture -
WCF

• This is used for building and developing


services based on WS-* standards
Components of .NET Framework 4.5 Architecture -
Asp.Net WebAPI

• Asp.Net Web API is a framework for building HTTP services


that can be consume by a broad range of clients including
browsers, mobiles, iphone and tablets.
Components of .NET Framework 4.5 Architecture -
Visual Studio 2012

• The Visual Studio IDE offers a set of tools that help you to
write and modify the code for your programs, and also detect
and correct errors in your programs.
• Using Visual Studio 2012 you can build Windows Store apps,
desktop apps, mobile apps, ASP.NET web apps, and web
services
What’s in the .NET Framework?

• The .NET Framework consists primarily of a huge library of


code that you use from your client languages (such as C#)
using object-oriented programming (OOP) techniques.
• This library is categorized into different modules
Example:
• one module contains the building blocks for Windows
applications, another for network programming, and another
for web development.
• Some modules are divided into more specific sub modules,
such as a module for building web services within the module
for web development.
CTS & CLS
• CTS and CLS are parts of
.NET CLR and are
responsible for type safety
with in the code.
• Both allow cross language
communication and type
safety.
What’s in the .NET Framework?

Common Type System(CTS):


• CTS stands for Common Type System.
• It defines the rules which Common Language Runtime follows when
declaring, using, and managing types.
• The common type system performs the following functions:
1. It enables cross-language integration, type safety, and high-
performance code execution.
2. It provides an object-oriented model for implementation of many
programming languages.
3. It defines rules that every language must follow which runs under
.NET framework. It ensures that objects written in different .NET
Languages like C#, VB.NET, F# etc. can interact with each other.
Common Language Specification (CLS):
• CLS stands for Common Language Specification and it is a subset of CTS.
• It defines a set of rules and restrictions that every language must follow which runs
under .NET framework.
• The languages which follows these set of rules are said to be CLS Compliant. In
simple words, CLS enables cross-language integration.
Example:
1. One rule is that you cannot use multiple inheritance within .NET Framework. As you
know C++ supports multiple inheritance but; when you will try to use that C++ code
within C#, it is not possible because C# doesn’t supports multiple inheritance.
2. One another rule is that you cannot have members with same name with case
difference only i.e. you cannot have add() and Add() methods. This easily works in
C# because it is case-sensitive but when you will try to use that C# code in VB.NET, it
is not possible because VB.NET is not case-sensitive.
Writing Applications Using the .NET Framework

• Writing an application using the .NET Framework means writing


code (using any of the languages that support the Framework)
using the .NET code library.

• In this course, you use Visual Studio for your development.

• VS is a powerful, integrated development environment that


supports C# (as well as managed and unmanaged C++,Visual Basic,
and some others).

• The advantage of this environment is the ease with which .NET


features can be integrated into your code.
Writing Applications Using the .NET Framework

• The code that you create will be entirely C# but use the .NET
Framework throughout, and you’ll make use of the additional
tools in VS where necessary.
• In order for C# code to execute, it must be converted into a
language that the target operating system understands,
known as native code.
• This conversion is called compiling code, an act that is
performed by a compiler.
• Under the .NET Framework, this is a two-stage process.
DYNAMIC TRANSLATION

COMPILATION AT RUN TIME


Common Intermediate
Language (CIL) code
• When you compile code that uses the .NET Framework library,
you don’t immediately create operating system–specific
native code. Instead, you compile your code into Common
Intermediate Language (CIL) code.
• CIL is also known as Microsoft Intermediate Language (MSIL)
• This code isn’t specific to any operating system (OS) and isn’t
specific to C#.
• Other .NET languages — Visual Basic .NET, for example — also
compile to this language as a first stage.
• This compilation step is carried out by VS when you develop
C# applications.
Just-in-time (JIT) compiler

• just-in-time (JIT) compiler, compiles CIL into native code that is


specific to the OS and machine architecture being targeted.
• Only at this point can the OS execute the application.
• The just-in-time part of the name reflects the fact that CIL
code is compiled only when it is needed.
• This compilation can happen on the fly while your application
is running.
Assemblies

• When you compile an application, the CIL code is stored in an


assembly.
• Assemblies include both executable application files that you
can run directly from Windows without the need for any
other programs (these have a .exe file extension) and libraries
(which have a .dll extension) for use by other applications.
Assemblies
• Assemblies also include meta information (Metadata) and
optional resources .
 Metadata is, information about the information contained in
the assembly.
 Optional resources - additional data used by the CIL, such as
sound files and pictures.
• The meta information enables assemblies to be fully self-
descriptive.
• This means that deploying applications is often as simple as
copying the files into a directory on a remote computer.
Managed Code

• Code written using the .NET Framework is managed when it is


executed.
• This means that the CLR looks after your applications by managing
memory, handling security, allowing cross-language debugging, and so
on.
• By contrast, applications that do not run under the control of the CLR
are said to be unmanaged, and certain languages such as C++ can be
used to write such applications, which, for example, access low-level
functions of the operating system.
• However, in C# you can write only code that runs in a managed
environment.
• You will make use of the managed features of the CLR and allow .NET
itself to handle any interaction with the operating system.
Garbage Collection

• One of the most important features of managed code is the


concept of garbage collection.
• This is the .NET method of making sure that the memory used
by an application is freed up completely when the application
is no longer in use.
• Prior to .NET this was mostly the responsibility of
programmers, and a few simple errors in code could result in
large blocks of memory mysteriously disappearing as a result
of being allocated to the wrong place in memory.
• That usually meant a progressive slowdown of your computer,
followed by a system crash.
Garbage Collection

• .NET garbage collection works by periodically inspecting the


memory of your computer and removing anything from it that
is no longer needed.
• There is no set time frame for this; it might happen thousands
of times a second, once every few seconds, or whenever, but
you can rest assured that it will happen.
Language
compilation in
.NET
Language compilation in .NET
• All the .NET languages are compiled into another lower-level
language before the code is executed.
• This lower level language is the Common Intermediate Language
(CIL, or just IL).
• The CLR, the engine of .NET, uses only IL code.
• Because all .NET languages are based on IL, they all have
profound similarities.
• This is the reason that the VB and C# languages provide
essentially the same features and performance.

You might also like