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

Visual Programming Unit 1

.NET Framework is a comprehensive environment for developing, executing, and deploying various applications, supporting multiple programming languages and enabling language interoperability. Key components include the Common Language Runtime (CLR), Common Type System (CTS), and Framework Class Library (FCL), which provide essential functionalities such as memory management, security, and access to system resources. The framework also includes features like simplified deployment, security measures, and the ability to create sharable components for distributed computing.

Uploaded by

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

Visual Programming Unit 1

.NET Framework is a comprehensive environment for developing, executing, and deploying various applications, supporting multiple programming languages and enabling language interoperability. Key components include the Common Language Runtime (CLR), Common Type System (CTS), and Framework Class Library (FCL), which provide essential functionalities such as memory management, security, and access to system resources. The framework also includes features like simplified deployment, security measures, and the ability to create sharable components for distributed computing.

Uploaded by

bhatt navtej
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

8/6/2020

INTRODUCTION
.NET FRAMEWORK

INTRODUCTION TO MICROSOFT .NET

 Microsoft .NET Framework architecture,


 Common Language Runtime,

 Common Type System,

 Microsoft Intermediate Language Assemblies,

 Namespaces and class libraries

1
8/6/2020

Generation Release Date Development Tool

4.5.2 Visual Studio 2015


2014-05-05

4.6 2015-07-20 Visual Studio 2015

4.6.1 Visual Studio 2015


2015-11-30
Update 1
4.6.2 Visual Studio 2017
2016-08-02
15.0
4,7 Visual Studio 2017
2017-04-05
15.1
4.7.1 Visual Studio 2017
2017-10-17
15.5
4.7.2 Visual Studio 2017
2018-04-30
15.8
4.8 Visual Studio 2019
2019-04-18
16.3

2
8/6/2020

.NET FRAMEWORK
.NET Framework is a complete environment that allows developers to
develop, execute, and deploy the following applications
 Console applications
 Windows Forms applications
 Windows Presentation Foundation (WPF) applications
 Web applications (ASP.NET applications)
 Web services
 Windows services
 Service-oriented applications using Windows Communication
Foundation (WCF)
 Workflow-enabled applications using Windows Workflow Foundation
(WF)
.NET Framework also enables a developer to create sharable
components to be used in distributed computing architecture.
.NET Framework supports the object-oriented programming model
for multiple languages, such as Visual Basic, Visual C#, and Visual C++.
.NET Framework supports multiple programming languages in a
manner that allows language interoperability.

FEATURES / ADVANTAGES
 Interoperability
 .Net framework provides the way to operate .Net application outside
the .Net environment.

 Common Language Runtime engine


 Common Language Runtime (CLR) is the virtual machine component of
the .NET framework. All .NET programs execute under the supervision
of the CLR, and it provides memory management, security, and
exception handling.

 Language independence
 .NET Framework introduces a Common Type System, or CTS. The CTS
specification defines all possible data types and programming
constructs supported by the CLR and how they may or may not interact
with each other. Because of this feature, the .NET Framework supports
the exchange of instances of types between programs written in any of
the .NET languages.

3
8/6/2020

FEATURES / ADVANTAGES
 Base Class Library
 The Base Class Library (BCL), part of the Framework Class Library (FCL),
is a library of functionality available to all languages using the .NET
Framework. The BCL provides classes which encapsulate a number of
common functions, including file reading and writing, graphic
rendering, database interaction and XML document manipulation.
 Simplified deployment
 The .NET framework includes design features and tools that help
manage the installation of computer software to ensure that it does
not interfere with previously installed software, and that it conforms to
security requirements.
 Security
 The design is meant to address some of the vulnerabilities, such as
buffer overflows, that have been exploited by malicious software.
Additionally, .NET provides a common security model for all
applications.
 Portability
 .NET framework permits it to be platform agnostic, and therefore it is
compatible with different platforms. This feature of Microsoft .NET
framework also makes a way for third parties to develop compatible
implementations of this framework and its languages on platforms
other than Microsoft.

Common Language Infrastructure (CLI)

 CLI is an open specification developed by Microsoft and


standardized by ISO and ECMA.
 CLI describes the executable code and runtime environment that
form the core of the Microsoft .NET Framework and the free and
open source implementations Mono and Portable.NET.
 The specification defines an environment that allows multiple high-
level languages to be used on different computer platforms without
being rewritten for specific architectures.
 CLI specification describes the following four aspects:
 Common Type System (CTS)
 Metadata
 Common Language Specification (CLS)
 Virtual Execution System (VES)

4
8/6/2020

Common Language Infrastructure


(CLI)

COMMON INTERMEDIATE LANGUAGE (CIL)


 (CIL) Common Intermediate Language is also known as (MSIL)
Microsoft Intermediate Language or IL ( Intermediate Language).
 CIL is the lowest-level human-readable programming
language defined by the Common Language Infrastructure (CLI)
specification.
 All .NET source code is compiled to CIL. Then CIL will be converted
to native code and code will be executed at run-time by a Just-In-
Time (JIT) compiler.

5
8/6/2020

COMMON LANGUAGE RUNTIME (CLR)


 Common Language Runtime (CLR) is the virtual machine and
core component of Microsoft's .NET framework and is responsible
for managing the execution of .NET programs.

 CLR is a common runtime environment for .NET native code which


is converted by MSIL or IL (Intermediate Language) from bytecode
that is complied with .NET compilers of respective language in .NET
Framework.

 CLR performs various tasks to manage the execution process of


.NET applications.
 The responsibilities of CLR are listed as follows:
Automatic memory management
Garbage Collection
Code Access Security
Code verification
JIT compilation of .NET code

COMMON LANGUAGE RUNTIME


(CLR)

6
8/6/2020

COMMON TYPE SYSTEM (CTS)


 The Common Type System (CTS) defines how types are declared,
used and managed in the runtime, and is also an important part of
the runtime(CLR)'s support for cross-language integration.

 The common type system performs the following functions:


 Establishes a framework that helps enable cross-language
integration, type safety, and high-performance code execution.
 Provides an object-oriented model that supports the complete
implementation of many programming languages.
 Defines rules that languages must follow, which helps ensure
that objects written in different languages can interact with
each other.
 Provides a library that contains the primitive data types (such
as Boolean, Byte, Char, Int32, and UInt64) used in application
development.

COMMON TYPE SYSTEM (CTS)


 All types in the .NET Framework are either value types or reference
types:

 Value types are data types whose objects are represented by


the object's actual value. If an instance of a value type is
assigned to a variable, that variable is given a fresh copy of the
value.

 Reference types are data types whose objects are represented


by a reference (similar to a pointer) to the object's actual value.
If a reference type is assigned to a variable, that variable
references (points to) the original value. No copy is made.

7
8/6/2020

COMMON LANGUAGE SPECIFICATION (CLS)

 It is a sub set of CTS and it specifies a set of rules that needs to be


adhered or satisfied by all language compilers targeting CLR. It
helps in cross language inheritance and cross language debugging.

Common language specification Rules:


1. Representation of text strings
2. Internal representation of enumerations
3. Definition of static members and this is a subset of the CTS
which all .NET languages are expected to support.
4. Microsoft has defined CLS which are nothing but guidelines
that language to follow so that it can communicate with
other .NET languages in a seamless manner.

FRAMEWORK CLASS LIBRARY (FCL)

 The .NET Framework class library is a library of classes, interfaces,


and value types that provide access to system functionality. It is the
foundation on which .NET Framework applications, components,
and controls are built.
 FCL contains thousands of classes to provide the access to Windows
API and common functions like String Manipulation, Common Data
Structures, IO, Streams, Threads, Security, Network Programming,
Windows Programming, Web Programming, Data Access, etc.
 It is simply the largest standard library ever shipped with any
development environment or programming language. The best part
of this library is they follow extremely efficient OO design (design
patterns) making their access and use very simple and predictable.

8
8/6/2020

9
8/6/2020

NAMESPACE
 The namespace is used to declare a scope that contains a set of
related objects. You can use a namespace to organize code
elements and to create globally unique types.
 Namespace is a collection of types.
 A namespace can contain one or more of the following types:
class, struct, interface, enum and delegate
 A namespace can have one or more sub namespaces defined in it.
 Namespace also avoids collision between names of types in a
program.
 By default a program has a namespace called <global namespace>
 using directive to allow the use of types in a namespace so that you
do not have to qualify the use of a type in that namespace:
ex. using System;

NAMESPACE
 Namespaces are heavily used in C# programming in two ways. First, the
.NET Framework uses namespaces to organize its many classes, as
follows:
 System is a namespace and Console is a class in that namespace.
The using keyword can be used so that the complete name is not
required, as in the following example:
 using System;
 System.Console.WriteLine("Hello World!");
 Second, declaring your own namespaces can help you control the
scope of class and method names in larger programming projects. Use
the namespace keyword to declare a namespace, as in the following
example:

10
8/6/2020

NAMESPACE
Example:
namespace SampleNamespace
{
class SampleClass
{
public void SampleMethod()
{
System.Console.WriteLine( "SampleMethod inside
SampleNamespace");
}
}
}

Using SampleNamespace;

ASSEMBLY
 Assemblies are the building blocks of .NET Framework applications;
they form the fundamental unit of deployment, version control,
reuse, activation scoping, and security.

 An assembly consist of one or more files (dlls , exe’s. html files etc.),
and represents a collection of types and resources that are built to
work together and form a logical unit of functionality.

 An assembly is completely self-describing. An assembly contains


metadata and manifest.

11
8/6/2020

TYPES OF ASSEMBLY
There are the two types of assemblies:

 Private Assembly - Refers to the assembly that is used by a single


application. Private assemblies are kept in a local folder in which
the client application has been installed.

 Public or Shared Assembly - Refers to the assembly that is allowed


to be shared by multiple applications. A shared assembly must
reside in Global Assembly Cache (GAC) with a strong name assigned
to it.

 For example, imagine that you have created a DLL containing


information about your business logic. This DLL can be used by your
client application. In order to run the client application, the DLL
must be included in the same folder in which the client application
has been installed. This makes the assembly private to your
application. Now suppose that the DLL needs to be reused in
different applications. Therefore, instead of copying the DLL in
every client application folder, it can be placed in the global
assembly cache using the GAC tool. These assemblies are called
shared assemblies.

METADATA
 An assembly metadata is binary information which describes the
description of an assembly, such as name, version, culture, public
key of an assembly along with the types exported, other assemblies
dependent on this assembly, and security permissions needed to
run the application.

 In addition, it stores the description of types, such as the name,


visibility, base class, interfaces implemented, and members, such as
methods, fields, properties, events, attributes and nested types.

 Metadata is stored in binary format. Therefore, metadata of an


assembly is sharable among applications that execute on various
platforms. It can also be exported to other applications to give
information about the services and various features of an
application.

12
8/6/2020

MANIFEST
 Assemblies maintain all their information in a special unit called the
manifest. Every assembly has a manifest.
The followings are the contents of an Assembly Manifest:

Execution Model of Assembly

13
8/6/2020

JUST-IN-TIME
(JIT)
 JIT compiler translates the MSIL code of an assembly to native
code and uses the CPU architecture of the target machine to
execute a .NET application.
 It also stores the resulting native code so that it is accessible for
subsequent calls.
 If a code executing on a target machine calls a non-native
method, the JIT compiler converts the MSIL of that method into
native code.
 JIT compiler also enforces type-safety in the runtime
environment of the .NET Framework.
 It checks for the values that are passed to parameters of any
method.
 The following are the various types of JIT compilation in .NET:
Pre - JIT
Econo - JIT
Normal - JIT

TYPES OF JIT
 Pre - JIT
 In Pre-JIT compilation, complete source code is converted into
native code in a single cycle (i.e. compiles the entire code into
native code in one stretch)
 This is done at the time of application deployment.
 In .Net it is called "Ngen.exe“

 Econo - JIT
 In Econo-JIT compilation, the compiler compiles only those
methods that are called at run time.
 After execution of this method the compiled methods are
removed from memory.

 Normal - JIT
 In Normal-JIT compilation, the compiler compiles only those
methods that are called at run time.
 After executing this method, compiled methods are stored in a
memory cache.
 Now further calls to compiled methods will execute the
methods from the memory cache.

14
8/6/2020

MANAGED CODE & UNMANAGE CODE

 The code which is produced by (vb.net,c#,j#) .net framework


language is called as managed code which is under the control of
CLR.Garbage collector run automatically in managed code.

 The code which is produced by third party language is called as


unmanaged code, which does not run under the control of
CLR.Garbage collector will not run in case of unmanaged code.

CLR EXECUTION MODEL

Source VB C# C++
code
Unmanaged
Compiler Compiler Compiler
component

Managed Assembly Assembly Assembly


code IL code IL code IL code

Common language runtime

JIT compiler

Native code

Operating system services

15

You might also like