You are on page 1of 27

Introduction to .

NET Framework

.NET Framework

What Is .NET
.Net is a new framework for developing
web-based and windows-based applications
within the Microsoft environment.
The framework offers a fundamental shift in
Microsoft strategy: it moves application
development from client-centric to servercentric.

The .NET Framework is a key Microsoft offering,


and is intended to be used by most new applications
created for the Windows platform.
It is a foundation to build and run .NET-based
applications.
The unified nature of the .NET Framework means
that all applications, whether they are Console
application, Windows applications, Web applications,
or XML Web services, are developed by using a
common set of tools and code, and are easily
integrated with one another.

.NET What Is It?

.NET Application

.NET Framework

Operating System + Hardware

Tools for .NET Development

The .NET Framework


.NET Framework Services
Common Language Runtime
Windows Forms
ASP.NET
Web Forms
Web Services

ADO.NET, evolution of ADO


Visual Studio.NET

Common Language Runtime


(CLR)
The common language runtime simplifies
application development,
provides a robust and secure execution
environment, supports multiple languages, and
simplifies application deployment and
management.
The common language runtime environment is also
referred to as a managed environment, in which
common services, such as garbage collection and
security, are automatically provided.

CLR
contd..

Common Language Runtime

Development
Mixed language applications

Common Language Specification (CLS)


Common Type System (CTS)
Standard class framework
Automatic memory management

Consistent error handling and safer execution


Potentially multi-platform

Deployment
Removal of registration dependency
Safety fewer versioning problems

Common Language Runtime


Multiple Language Support
CTS is a rich type system built into the CLR
Implements various types (int, double, etc)
And operations on those types

CLS is a set of specifications that language


and library designers need to follow
This will ensure interoperability between
languages

Common Type System


The Common Type System provides a specification
for how types are
Defined
Managed
Used
This is important for cross-language integration!
The CTS provides rules that languages must obey, to
ensure that types created in different languages can
interoperate with one another.

Common Language Specification


The Common Language Specification is a set of rules
and constraints that compiler and library writers need
to follow to be sure that the languages and code they
produce will interoperate with other .NET languages.
The Common Language Specification is a subset of
the Common Type System.

CTS
CLS

If language complies to CLS it can interoperate


with other .NET languages

Compilation in .NET
Code in VB.NET

Code in C#

Code in another
.NET Language

VB.NET compiler

C# compiler

Appropriate
Compiler

IL(Intermediate
Language) code

CLR just-in-time
execution

Intermediate Language (IL)


.NET languages are not compiled to machine code. They
are compiled to an Intermediate Language (IL).
CLR accepts the IL code and recompiles it to machine
code. The recompilation is just-in-time (JIT) meaning it is
done as soon as a function or subroutine is called.
The JIT code stays in memory for subsequent calls. In
cases where there is not enough memory it is discarded
thus making JIT process interpretive.

CLR and MSIL Analogy


Japanese

Chinese

Intermediate Language

Intermediate Language

Interpreter
English

NAMESPACE
Namespace is a way to keep one set of names separate
from another.
It organizes code and gives a way to create globallyunique types.
In C#, namespaces are used to logically arrange
classes, structs, interfaces, enums and delegates.
The namespaces in C# can be nested. That means one
namespace can contain other namespaces also.
User can define their own namespaces.
A Namespace in Microsoft .Net is like containers of
objects. They may contain unions, classes, structures,
interfaces, enumerators and delegates

Goal of using namespace in .Net is for creating a


hierarchical organization of program.
In Microsoft .Net, every program is created with a default
namespace named as global namespace.
Program itself can declare any number of namespaces,
each of them with a unique name.
The advantage is that every namespace can contain any
number of classes, functions, variables and also
namespaces etc., whose names are unique only inside the
namespace. The members with the same name can be
created in some other namespace without any compiler
complaints from Microsoft .Net.

Namespaces

(contd)

Used to avoid naming conflicts


A default namespace is created even if one is not
created.
Reduces complexity when code is to be re-used for
some other application
Declaring a Namespace
Syntax
Namespace Namespace name
{
//all classes for namespaces go here
}

Class Library
The .NET Framework class library exposes features
of the runtime and simplifies the development of
.NET-based applications. In addition, developers can
extend classes by creating their own libraries of
classes.
The .NET Framework class library implements the
.NET Framework.
All applications (Web, Windows, and XML Web
services) access the same.NET Framework class
libraries, which are held in namespaces. All .NETbased languages also access the same libraries.

NET Framework Class Library.

Introduction: What is Assembly


An Assembly is a logical unit of code ,physically exist as
DLLs or EXEs
The entire .NET code on compilation gets converted into an
Intermediate Language (IL) code and gets stored as an
assembly.
An assembly is a self-describing unit of reuse, versioning,
security and deployment.
One assembly can contain one or more files
When compiling the source code by default the exe/dll
generated is actually an assembly
Unless the code is bundled as assembly it can not be used in
any other application
Version of a component actually means version of the
assembly to which the component belongs.

Cont.
An assembly is a means of reusing code

Assembly Structure

contd.
Assembly Metadata- .NET metadata can be
thought of simply as a collection of information
existing in binary form inside a Portable
Executable (PE) file or a .NET assembly
Type Metadata-Type Metadata describes the
data present in the assembly and its type. This
metadata contains a declaration for every type
and member(methods, fields, properties, and
events).

contd.

MSIL Code -.NET compilers compile the


source code into an Intermediate Language
called MSIL (Microsoft Intermediate
Language

Resources-While developing applications,


more than often one will make use of JPEG,
text, XML and other types of files in an
application. These miscellaneous picture and
sound files are termed as resources

Types Of Assembly
There are two types of assembly
a).Private assembly
b).Public assembly.
A private assembly deployed with application, and
stored in the application's directory. It is used by only
one application .
A shared assembly is stored in the global assembly
cache (GAC), maintained by the .NET runtime. It is
shared among different application .
One more type of assemblies called satellite
assemblies are used for localization.(partition the
resources based on a specific culture).

You might also like