Introduction
Introduction
NET
'
What is .NET
It is an open source platform developed by Microsoft for
building many types of applications
A .NET application can be developed in multiple languages,
using different editors and libraries
Some of the languages are C#, F#, Visual C++, Visual Basic etc
It is tool to build and run C# programs and other language
programs
When .NET is downloaded, many other programs are
downloaded that translate code into instructions that are
understandable by the computer
It also provide utilities for building software
It defines a set of data types to store information in programs
.NET Versions
There are few versions of .NET to do a particular job
under different platforms/ environments
.NET framework is the original version of .NET that only
runs on Windows platform
.NET core is the new cross-platform version of .NET that
runs on Windows, MacOS and LINUX computers
Languages in .NET
.NET application can be written in C#, F# or Visual
Basic
C# is a simple, modern, object-oriented and type safe
programming language
F# is a programming language that makes it easy to
write concise, robust and performant code
Visual Basic is an approachable language with a simple
syntax for building type-safe object-oriented apps
Cross-platform
The code developed in any of the language will run
natively on any compatible operating system
Many types of apps can be developed with .NET. Some
are cross platform and some target-specific set of
operating systems and devices
.NET Classes and API
.NET provides a standard set of base class libraries
and API's that are common to all .NET applications
Each application model can also expose additional
API's that are specific to the operating system it runs
on or the capabilities it provides
For example:
ASP.NET is the cross-platform web framework that
provides additional API's for building web apps that runs
on Windows or Linux
ASP.NET
To build programs for the web like websites more tools
are to added on top of .NET
One of the popular tools is ASP.NET
To keep .NET and ASP.NET separate, .NET is called a
platform and ASP.NET is called a framework
.NET Strategy
.NET is a software framework that includes everything
required for developing software for web services
It integrates presentation technologies, component
technologies and data technologies on a single
platform
It enables users to develop internet applications as
easily as on a desktop system
.NET Software Components
Microsoft .NET software solution includes three key
components
Microsoft .NET Platform
Microsoft .NET Products and Services
Third-party .NET Services
.NET Platform
Microsoft .NET platform includes the following
components to help develop a new generation of smart
Internet Services
.NET infrastructure and tools
.NET user experience
.NET building block
.NET device software
.NET Products and Services
Microsoft .NET products and services consists of the
following:
Windows .NET
MSN .NET
Office .NET
Visual Studio .NET
Personal subscription services etc
Third Party Services
Third-party .NET services will provide opportunities
to a vast range of developers and users to produce
corporate and vertical services using .NET platform
Technological Development of .NET
The current technology of .NET has gone through
three significant phases of development
OLE Technology
COM Technology
.NET Technology
OLE Technology
OLE technology was developed by Microsoft in the early
1990's to enable easy inter process communications
OLE provided support to achieve the following
To embed documents from one application into another
application
To enable one application to manipulate objects located in
another application
This enabled users to develop applications which
required inter-operability between various products
such as MS-Word and MS-Excel
COM Technology
Before COM Technology the monolithic approach had been used for developing
software
When programs become too large and complex, this approach created problems in
terms of maintainability and testing of software
This problem was overcome by the introduction of component-based approach for
developing software
A program is broken into a number of independent components where each one offers a
different functionality
Each component can be developed and tested independently and then integrated into
the main system
This is known as Component Object Model (COM) and the software built using COM is
referred to as componentware
COM technology advantages are:
Reduces the overall complexity of the software
Enables distributed development environment across multiple departments or
organizations
Enhances software maintainability
.NET Technology
.NET technology is a third generation component model
It provides a new level of inter-operability compared to COM
technology
COM provides a standard binary mechanism for inter-module
communication
This is replaced by an Intermediate Language called (MSIL) or simply
IL in the .NET technology
Various .NET language compilers enforce inter-operability by compiling
code into IL.
IL is automatically compatible with other IL modules
IL allows true cross-language integration
In addition to IL , .NET includes a host of other technologies and tools
that enables to develop and implement Web-based applications easily
.NET Framework
It is a software development framework developed by Microsoft that
provides a common programming platform for the development of
applications such as Websites
It was originally released with Microsoft's first version of its
Windows OS in 1993 and has undergone various changes since then
.NET framework is the tool provided by the .NET infrastructure and
tools component of the .NET platform
.NET platform provides a new environment for creating and
running robust, scalable and distributed applications over the Web
C# derives much of its power from .NET framework on which it
runs
It is a collection of software components and API's for building and
running applications on Microsoft's .NET platform
This includes Windows, Windows Phone, Windows Server and other
operating systems
It provides a common programming model that developers can use to
create programs that can run on multiple platforms
It enables to write once and save it in different projects for different types
of devices
It also includes number of libraries that provide common functionality
such as data access, controls and user interfaces
These libraries make it easier to build applications that work across
multiple platforms
.NET Framework is a key component of the Microsoft .NET system and is
available for free under an open source license
Features of .NET Framework
It provides an environment for building, deploying and running
web services and other applications.
It consists of three distinct technologies
Common Language Runtime (CLR)
Framework base Classes
User and Program Interfaces (ASP.NET and Winforms)
For the programs coded in any of the supported language
CLR is the core of the .NET framework and is responsible for loading
and execution of programs
Base classes provide basic data types, collection classes and other
general classes to be used by C# & any other languages
The top layer consists of a set of classes for developing web services
and to deal with the user interface
.NET Framework Architecture
The architecture of .NET framework focuses on two
things
The framework code is largely independent of the
language in which it is written.
For eg: A framework written in C# can also call libraries
written in C++ or other programming languages which makes
it portable to other platforms
Second goal is that it should be easy to adopt i.e. it is
designed in such a way that it makes it easy to
incorporate new features and new functionality into an
existing program
The Key Components
Language Library CLR
Common
Framework
Winform Language
Class Library
Runtime
ADO.NET
WinForms
It is a smart client technology for the .NET framework
It is a free and open source GUI class library included
as a part of .NET Framework to provide a platform for
developing client side applications for desktop, laptop
etc.
It is a set of managed libraries that simplifies common
application tasks such as reading and writing to the
file systems
ASP.NET
It is a server side technology and a web framework
designed and developed by Microsoft
It is used to develop dynamic websites, web
applications and web services
It provides an integration of HTML, CSS and
Javascript
ADO.NET
It is a module of .NET framework which is used to
establish a connection between application and data
sources
Data sources can be SQL Server
ADO.NET contains classes that can be used to
connect, retrieve, insert and delete data
Common Language Infrastructure (CLI)
of .NET
CLI is a platform-independent development system from Microsoft that
enables program written in different languages to run on different types of
hardware
CLI is an app development framework that is language-independent
which makes it easier to port the application across different platforms
It streamlines the process of migrating app across different platforms due
to standard code structure, a single standard library, a single standard
application deployment process across all platforms
Developers do not have to worry about changing the language or syntax of
their source code while switching from one platform to another
CLI includes CTS and CLS
It does not matter in what language the program is written, they are
compiled into Intermediate Language which is further compiled into the
target machine language by CLR
Common Type Systems(CTS)
.NET framework provides multiple language support using the feature
known as Common Type Systems that is built into the CLR
A language supporting multiple data types is known as CTS. It
standardizes the data types of all programming languages under the .NET
umbrella
CTS supports a variety of types and operations found in most
programming languages and therefore calling one language from another
does not require type conversions
It defines how these types are declared, used and managed in the runtime
It facilitates cross-language integration, type safety and high-performance
code execution
C# is specially designed for .NET platform , but a number of .NET
programs in number of other languages including C++ and Visual Basic
can be build
Common Language Specifications(CLS)
The CLS defines a set of rules that enables inter-operability on the
.NET platform
It defines a set of rules and restrictions that every language must
follow which runs under the .NET framework
The languages which follows this set of rules are said to be CLS
compliant which enables cross-language integration
These rules serves as a guide to third-party compiler designers
and library builders
CLS is a subset of CTS and therefore language supporting CLS
can use each other's libraries as if they are own
Application Program Interfaces(API's) that are designed following
the rules of CLS can easily be used by all other .NET languages
Common Language Runtime(CLR)
CLR is the core i.e. heart and soul of the .NET framework
It is included during the installation of the framework
When IIS is installed it is automatically installed
It is a runtime environment in which programs written in C# and any other .NET languages
are executed
It also supports cross-language inter-operability
Services provided by CLR are
Loading and execution of programs
Memory isolation for other programs
Verification of type safety
Compilation of IL into native executable code
Providing metadata
Memory management(automatic garbage collection)
Enforcement of security
Inter-operability with other systems
Managing exceptions and errors
Support for tasks such as debugging and profiling
CLR Activities when application is executed
Source code is compiled into IL
Metadata engine creates meta information
IL & Metadata are linked with other native code if
required and resultant code is saved
During execution IL and any other requirement from the
base class library are brought together by the class loader
The combined code is tested for type safety
Then it is compiled by the JIT(Just-in-time) compiler to
produce native machine code which is sent to the run-
time manager for execution
Microsoft Intermediate Language(MSIL)
MSIL or IL is an instruction set into which all the .NET programs are compiled
It is similar to assembly language and contains instructions for loading,
storing, initializing and calling methods
When a C# program or any other language program coded in CLS-compliant
language, the source code is compiled into MSIL
MSIL defines a set of portable instructions that are independent of any
specific CPU.
In essence, MSIL defines a portable assembly language.
One other point: Although MSIL is similar in concept to Java’s bytecode, the
two are not the same.
It is the job of the CLR to translate the intermediate code into executable
code when a program is run. Thus, any program compiled to MSIL can be
run in any environment for which the CLR is implemented. This is part
of how the .NET Framework achieves portability.
Managed Code
CLR is responsible for managing the execution of code
compiled in the .NET platform
The code that is executed as per the specifications of the CLR
during runtime is called the managed code
Compilers that are compatible to .NET platform generates
managed code
For example:
C# compiler generates managed code which is the IL code
All manged code generated by C# compiler or any other compiler
capable of generating managed code is called the IL code
This IL code is then converted into native machine code by the JIT
compilers
Unmanaged Code
The opposite of managed code is unmanaged code.
Unmanaged code does not execute under the
Common Language Runtime and is executed by the
Operating System
All Windows programs prior to the creation of
the .NET Framework uses unmanaged code.
It is possible for managed code and unmanaged code
to work together, so the fact that C# generates
managed code does not restrict its ability to operate in
conjunction with preexisting programs
Framework Class Library(FCL)
It has some advance class libraries
It is a superset of BCL
It is a wider library that contains ASP.NET, WinForms,
XML stack, ADO.NET
Framework Base Classes(BCL)
Base Class Library(BCL) is also known as Class Library is a core class library
It is a subset of Framework Class Library
It is a collection of reusable types that are closely integrated with CLR
These libraries can be used by
simply instantiating them and invoking their methods OR
Inheriting them through derived classes and thus extending their
functionalities
Many of the functionality in the base framework classes reside in the vast
namespace called "System"
The base classes of the "System" namespace can be used for
Input/Output operations
String Handling
Manging arrays, lists, maps, etc.
Accessing files and file systems
Accessing the registry
Security
Windowing
Windows Messages
Database management
Evaluation of mathematical functions
Drawing
Managing Errors and exceptions
Connecting to the internet etc.
User and Program Interfaces
The following tools are provided by .NET Framework
for managing user and application interfaces
Windows forms
Web Forms
Console Applications
Web Services
These tools enable to develop user-friendly desktop-
based as well as web-based applications using a wide
variety of languages on the .NET platform
Visual Studio .NET
Visual Studio .NET (VS .NET) supports an Integrated
Development Environment(IDE) with a rich set of features and
productivity tools
These tools enables faster development of web-applications
Using Web services and XML , a single environment is to be
learnt, configured and is used irrespective of the language used
No need to switch back and forth between environments to
build, debug and deployment of code
It provides tools that extends support to the development cycle
It acts as a foundation for the life cycle platform
.NET Languages
Following are some of the languages that can be used to build application
in .nET environment
C# (Specially created for .NET)
C++
Visual Basic
Jscript
Third-party languages
COBOL
Eiffel
Perl
Python
SmallTalk
Mercury
Scheme
Advantages of .NET approach
Simple and faster system development
Rich object model
Enhanced built-in functionality
Many different ways to communicate with the outside world
Integration of different languages into one platform
Easy deployment and execution
Wide range of scalability
Inter-operability with existing applications
Simple and easy to build sophisticated development tools
Fewer bugs
Potentially better performance
C# and the .NET
C# is a new programming language introduced
with .NET
It is a concise and elegant .NET language
In many ways it is a version of the .NET object model
With C# developers can quickly implement
applications and components using the built-in
capabilities of the .NET framework
Since C# code is managed by the CLR it becomes
leaner and safer than C++
To build program with C#, .NET platform is required
How C# Relates to the .NET Framework
Although C# is a computer language that can be studied on
its own, it has a special relationship to its runtime
environment, the .NET Framework. The reason for this is
twofold.
First, C# was initially designed by Microsoft to create code for
the .NET Framework.
Second, the libraries used by C# are the ones defined by
the .NET Framework.
Thus, even though it is possible to separate C# the language
from the .NET environment, the two are closely linked.
Because of this, it is important to have a general
understanding of the .NET Framework and why it is
important to C#.
C# and the .NET
CLR extend number of benefits to C# when it is
implemented on the .NET platform which are as
follows:
Interoperability with other languages
Enhanced security
Versioning support
Debugging support
Automatic garbage collection
XML support for Web-based applications