Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
18 views

Introduction To

Uploaded by

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

Introduction To

Uploaded by

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

Introduction to .

NET Framework

-Miss.Mali Runali Y.
Overview of .NET


.NET is an open-source and cross-platform development platform for building many
types of applications. Designed by Microsoft, the platform supports multiple
programming languages and libraries to build web, mobile, desktop and more.
• This free cross-platform framework accepts multiple coding languages and
features large code libraries that make it easy to build applications for mobile devices,
desktops, the web applications.

Since Microsoft released the first version in 2002, developers and companies have
used the .NET Framework to create form-based and web-based applications.
What is .NET Framework?

• .NET is a framework to develop software applications. It was designed


and developed by Microsoft and the first beta version got released in
2000.
• It provides a controlled programming environment where
software is often developed, installed and executed on Windows-based
operating systems.
• It contains many class libraries known collectively as Framework
Class Library (FCL).
• .NET is a framework that provides various services like memory
management, networking, security and type safety.
• Also, it supports more than 60 programming languages such as C#,
F#, VB.NET, J#, VC++, JScript.NET, APL, COBOL, Perl, Pascal, Python etc.
Common Language Runtime in .NET Framework

• Software programs written in .NET are executed in the


execution environment, which is called Common
Language Runtime (CLR).
• CLR provides a managed execution environment
for .NET programs by improving the security, including
cross-language integration and a rich set of class
libraries.
• To summarize, CLR is responsible for converting
source code into machine readable code.
Main components of CLR:

• Common Language Specification (CLS): it’s liable for converting the various .NET
programming language syntactical rules and regulations into CLR understandable
format.
• Common Type System (CTS): CTS is responsible for the understanding the data
types of .NET programming languages and converting them into CLR
understandable format i.e. Value Type and Reference Type.
• Garbage Collection (GC): It is used to provide the Automatic Memory Management
feature.
• Just In – Time Compiler (JIT): It is responsible for converting the Common
Intermediate Language (CIL) into machine code or native code using the Common
Language Runtime environment
How .NET language work
• Now, you may be confused about what the role of Visual Studio is.
Microsoft Visual Studio is an Integrated Development Environment (IDE)
which helps develop websites, web apps, web services, mobile apps,
Windows API, Windows Forms, Windows Presentation Foundation and
Console applications.
Features of .NET

1. Language and platform interoperability


The .NET Framework allows developers to build apps using a
diverse array of compliant languages, including C#, F# and VB.Net and
other conforming .NET languages.
This makes one language accessible to other languages, allowing
developers to build apps in their preferred languages. Programmers
can also use the .NET Framework to create apps for the web, desktop,
gaming, mobile, servers and IoT.
2. Version compatibility
Microsoft ensures that older versions of the .NET Framework can
work seamlessly with later versions without modifications.
3. Reliability

.NET has been used to develop and run thousands of applications

since its release in 2002. Despite the creation of new versions, the

earlier renditions still deliver a reliable performance.

4. Portability

Applications developed on the .NET Framework can work on any

Windows platform. It also has cross-platform capabilities, allowing

developers to run applications on other operating systems. Third

parties can create compatible implementations of the framework on

other platforms using conforming languages.


5. Memory management

The .NET Framework uses the Common Language Runtime for

memory management on behalf of an application.

It does this via a program called the Garbage Collector, which

checks unused system resources at intervals to free up memory. In

many programming languages, programmers allocate and release

memory while the application is running.

6. Large class library

The .NET Framework provides a vast class library of tested and

readily accessible code that programmers can use for common coding

operations.

This helps to increase productivity and reduce application

development time.
7.Security
The .NET Framework provides a robust security mechanism
that validates and verifies applications before granting the user
access to the program or its source code.
8. Improved productivity

The .NET Framework provides extensive tools and class


libraries that make it one of the most productive platforms for
programmers. It offers multi-language support, common APIs and
other services that allow developers to build high-quality

applications in less time.


9. Open source
Another great advantage of the .NET Framework is its
open-source structure.
A community of more than 60,000 programmers from
thousands of companies like Google, Samsung, Red Hat and the
Technical Steering Group contribute to the .NET Framework
through the .NET Foundation.
This supportive community improves the framework and
provides support for users who may encounter technical
challenges while interacting with the platform.
Managed And Unmanaged code
MANAGED CODE

As we have seen in the beginning, the code which is developed


using the Common Language Runtime (CLR) of the .NET framework is
known as Managed Code.
In other words, it is the code that gets executed directly in C#.
The runtime environment for managed code provides a variety of services
to the programmer.
The services provided are exception handling, garbage collection,
type checking, etc. The above-mentioned services are provided to the
programmer automatically. Apart from the above-mentioned services the
runtime environment also provides memory allocation, object disposal,
object creation, etc.
EXECUTION OF MANAGED CODE
The managed code is always compiled by the CLR into an intermediate
language known as MSIL and after that, the executable of the code is
created.
The intermediate language (MSIL) in the source code is compiled by the
compiler named ‘Just In Time Compiler’ when the executable is run by the
programmer.
Here the whole process is carried under a runtime environment, hence the
runtime environment is the reason behind the working of the program.
Advantages:
• Garbage collection is automatically implemented.

• Dynamic type checking or runtime type checking is also provided


Unmanaged Code

• The Unmanaged Code is also known as Unsafe Code. Unmanaged code


depends on the computer architecture as it aims for the processor
architecture.
• In C#, the activities like managing stacks, allocation, and release of memory,
etc. are taken care of by the CLR and hence these activities are out of the
purview of the programmer.

The programmer tells the compiler that the management of


the code will be done by him/her when he/she uses the keyword “unsafe”.
However, issues like memory leaks can happen if a programmer writes bad

code.
EXECUTION OF UNMANAGED CODE
• For executing unmanaged code wrapper classes are used in
C#. In C# the unmanaged code is directly executed by the
operating system.
• Generally, the executable files of unmanaged or
unsafe code are in the form of binary images which are loaded
into the memory. The steps of execution of the code can be
seen in the above image.
• Advantages:
Unsafe code increases stability and the performance
of the program
Low-level access to the programmer is provided
METADATA

Metadata is machine-readable information about a resource, or “data about


data.”
Such information might include details on content, format, size, or other
characteristics of a data source also consists of self-describing files, assemblies, and
common language runtime modules that can easily talk to the OS and don’t even need
registration
Special metadata known as attributes are declared by .NET and can control
program behavior at execution
Metadata offers detailed data regarding compile code in
another language and hence supports language interoperability.

In.NET, metadata is binary information which describes our


program that is stored either in common language runtime portable
executable file or in memory.

When you will compile the code into a portable executable file,
metadata is inserted in one portion of the file and the code is converted
into Microsoft Intermediate Language (MSIL) and then inserted into
another portion of the file.
.NET FRAMEWORK
There are following components of .NET Framework:

1.CLR (Common Language Runtime)


2.CTS (Common Type System)
3.BCL (Base Class Library)
4.CLS (Common Language Specification)
5.FCL (Framework Class Library)
1. CLR (Common Language Runtime)
It is a platform on which .net programs are executed. as we said
developer can choose any .net programming language for it.

CLR manages the execution of the program written in any


language. JIT (Just-in-time) Compiler is a part of CLR that converts the
managed code which is compiled intermediate language code, into
machine instructions and then executed on the CPU of the computers.

When the code is compiled, the compiler converts its source


code into the intermediate language (IL) which is CPU independent. now
the JIT (just in time) compiler compiles the IL code into its CPU specific
native code.

CLR now allocates the memory for the program in scope and de-
allocates the memory when it is not required or it is completed.
• It provides a robust and secure execution environment. It provides an interface

between the framework and operating System.

• It has many major features so Let’s have a look at its major features.

• Code Access security

• Memory management

• Thread support

• Debug engine

• Capabilities in optimizing, securing and providing robust capabilities like

application deployment and side by side execution.

• Garbage collection which removes unwanted resources when it is not required

• Exception handling which includes cross-language exceptions. Exceptions are

errors when the program or application is executed

• JIT Compilation (Just-In-Time)


Converting Source code into native code
• CTS (Common Type System)
It specifies a standard that represent what type of data and value
can be defined and managed in computer memory at runtime.

A CTS ensures that programming data defined in various


languages should beinteract with each other to share information.

For example, in C# we define data type as int, while in VB.NET


we define integer as a data type.

A language supporting multiple data types is known as a


common type system. In the example, .NET types are used as an
example.
• 2..BCL (Base Class Library)

• It is a standard library that is a collection of thousands of classes and used


to build an application. The BCL (Base Class Library) is the core of the FCL
and provides basic functionalities.
• The base class library has a rich collection of libraries features and
functions that help to implement many programming languages in
the .NET Framework, such as C #, F #, Visual C ++, and more.
Furthermore, BCL divides into two parts:
• User defined class library
– Assemblies - It is the collection of small parts of deployment an
application's part. It contains either the DLL (Dynamic Link Library)
or exe (Executable) file.
• In LL, it uses code reusability, whereas in exe it contains only
output file/ or application.
• DLL file can't be open, whereas exe file can be open.
• DLL file can't be run individually, whereas in exe, it can run
individually.
• In DLL file, there is no main method, whereas exe file has main
method.
• Predefined class library
– Namespace - It is the collection of predefined class and method
that present in .Net. In other languages such as, C we used header
files, in java we used package similarly we used "using system"
in .NET, where using is a keyword and system is a namespace.
Namespace Description

This namespace includes all the essential support you


need for your programming, including base types (String,
System
Int32, DateTime, Boolean, etc.), essential environmental
support, and math functions, to name a few

all the support necessary to be able to create code, and


System.CodeDom
run it, on the fly

The System.Collections namespace contains interfaces


System.Collections and classes that define various containers, such as lists,
queues, bit arrays, hashtables and dictionaries.
CLS (Common language
Specification)

It is a subset of common type system (CTS) that defines a set of rules and
regulations which should be followed by every language that comes under the .net
framework.
In other words, a CLS language should be cross-language integration or
interoperability.
For example, in C# and VB.NET language, the C# language terminate each
statement with semicolon, whereas in VB.NET it is not end with semicolon, and when these
statements execute in .NET Framework, it provides a common platform to interact and share
information with each other.
Common Type System and CLS(Common Language Specification
)

CLS A subset of Common Type System CLS helps in easy creation


of the apps and software.
It is the standardized set of rules and guidelines that are followed
to develop software in one language.
It helps in reducing the complexity of the apps and software.
Common Language Specification also helps in reduction of cost.
It helps in reducing the development time and cost.
FCL (Framework Class Library)

It provides the various system functionality in the .NET Framework, that includes
classes, interfaces and data types, etc. to create multiple functions and different types of
application such as desktop, web, mobile application, etc. In other words, it can be defined as, it
provides a base on which various applications, controls and components are built in .NET
Framework.
Key Concepts:
Implementation of data structure
Base data types
Garbage collection
Security and database connectivity
Creating common platform for window and web-based application

You might also like