Visual Programming Unit 1
Visual Programming Unit 1
INTRODUCTION
.NET FRAMEWORK
1
8/6/2020
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.
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.
4
8/6/2020
5
8/6/2020
6
8/6/2020
7
8/6/2020
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.
11
8/6/2020
TYPES OF ASSEMBLY
There are the two types of 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.
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:
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
Source VB C# C++
code
Unmanaged
Compiler Compiler Compiler
component
JIT compiler
Native code
15