CHAPTER TWO
Introduction to .NET
.NET Framework & Its
Architecture
Oct 17, 2025
Software Framework?
A software framework is a universal, reusable
software platform used to develop applications,
products and solutions.
Event Driven Programming
Software frameworks include:
Support programs,
Compilers,
Code libraries,
An application programming interface (API) and
Toolsets that bring together all the different
components to enable development of a project or
solution. 2
.Net - What is It?
Oct 17, 2025
• Microsoft .NET is a Framework
• It is language neutral software which provides a
common platform for building, running and
experiencing the next generation of distributed
applications
Event Driven Programming
• Not a language
• It designed to fulfill the following objectives:
Provide object-oriented programming
environment
Provide environment for developing various types
of applications, such as Windows-based
applications and Web-based applications
To ensure that code based on the .NET Framework 3
What is .NET? …
• .NET is a platform that provides a
standardized set of services.
It’s just like Windows, except distributed
over the Internet.
It exports a common interface so that it’s
programs can be run on any system that
supports .NET.
• A specific software framework
Includes a common runtime
What is .NET …
.NET platform infrastructure comprises five pillars
1. .NET Framework: may be viewed as is software development environment
or as a runtime engine for managed code.
2. Microsoft visual [Link] (the developers toolkit): is not an integral
of .NET, but it is an independent platform to provide all the tools required for
developers to build applications.
3. The .NET enterprise servers: These services include Microsoft SQL
server, Microsoft Exchange Enterprise Server, Microsoft Commerce Server, &
Microsoft Mobile Information Server, etc.
4. Microsoft [Link]: is a new OS over which the .NET is going to
work in the future.
5. Compact Real time for Mobile Devices: is runtime designed for mobile
devices that can run on Window CE (Embedded Compact) operating system.
5
.NET Framework
• Programming model for .NET
• Platform for running .NET managed code in a virtual
machine
• Provides a very good environment to develop
networked applications and Web Services
• Provides programming API and unified language-
independent development framework
.NET Framework …
.NET Framework Architecture
[Link]: is a unified web development platform that provides necessary
services for developers to build enterprise web based applications .
[Link]: provides a most general solution for data access and
manipulation.
Web services: is a network interface to application functionality based on
standard internet technology.
Winforms, which is a subset of .NET base classes, provides Graphical User
Interfaces.
.NET support three type of interface: Window Forms, Web Forms and Console
Application.
Common Language Runtime (CLR):- is an environment in which
programs are executed.
7
.NET Framework …
The Core of .NET Framework Architecture
• Common Language Runtime
Garbage collection
Language integration
Multiple versioning support (no more DLL hell!)
Integrated security
• Framework Class Library
Provides the core functionality:
[Link], Web Services, [Link], Windows Forms,
IO, XML, etc.
.NET Framework …
Common Language Runtime
CLR manages code execution at runtime
Memory management, thread management,
etc.
Common Language Runtime
Operating System
.NET Framework …
Base Class Library
Object-oriented collection of reusable types
Collections, I/O, Strings, …
.NET Framework (Base Class Library)
Common Language Runtime
Operating System
.NET Framework …
Data Access Layer
Access relational databases
Disconnected data model
Work with XML
ADO .NET and XML
.NET Framework (Base Class Library)
Common Language Runtime
Operating System
.NET Framework …
[Link] & Windows Forms
Create application’s front-end – Web-based user
interface, Windows GUI, Web services, …
ASP .NET Windows
Web Forms Web Services
Mobile Internet Toolkit
Forms
ADO .NET and XML
.NET Framework (Base Class Library)
Common Language Runtime
Operating System
.NET Framework …
Programming Languages
Use your favorite language
C++ C# [Link] Perl J# …
ASP .NET Windows
Web Forms Web Services
Forms
Mobile Internet Toolkit
ADO .NET and XML
.NET Framework (Base Class Library)
Common Language Runtime
Operating System
.NET Framework …
Common Language Specification
C++ C# VB Perl J# …
Common Language Specification
ASP .NET Windows
Web Forms Web Services
Forms
Mobile Internet Toolkit
ADO .NET and XML
.NET Framework (Base Class Library)
Common Language Runtime
Operating System
.NET Framework …
Visual Studio .NET
Visual Studio .NET
C++ C# VB Perl J# …
Common Language Specification
ASP .NET Windows
Web Forms Web Services
Forms
Mobile Internet Toolkit
ADO .NET and XML
.NET Framework (Base Class Library)
Common Language Runtime
Operating System
Common Type System (CTS)
• All .NET languages have the same primitive data types.
An int in C# is the same as an int in [Link]
• When communicating between modules written in
any .NET language, the types are guaranteed to be
compatible on the binary level
• Types can be:
Value types – passed by value, stored in the stack
Reference types – passed by reference, stored in the heap
• Strings are a primitive data type now
Common Language Specification (CLS)
• Any language that conforms to the CLS is a .NET
language
• A language that conforms to the CLS has the ability to
take full advantage of the Framework Class Library
(FCL)
• CLS is standardized by ECMA
.NET Languages
• Languages provided by Microsoft
C++, C#, J#, [Link], JScript
• Third-parties languages
Perl, Python, Pascal, APL, COBOL, Eiffel, Haskell, ML,
Oberon, Scheme, Smalltalk…
• Advanced multi-language features
Cross-language inheritance and exceptions handling
• Object system is built in, not bolted on
No additional rules or API to learn
.NET Framework Consists of:
Oct 17, 2025
1. Common Language Specification (CLS)
contains guidelines, that language should follow so that they
can communicate with other .NET languages.
responsible for Type matching (properly interoperate with
other languages)
Event Driven Programming
2. Framework Base Class Libraries (BCL)
collection of ready-made reusable classes that work with CLR
consistent, object-oriented library of prepackaged functionality
and Applications.
Programmers using any of .NET languages can use these
classes to include in their applications.
Examples of the classes provided by the library are:
Database access and manipulation
User Interface – Windows Forms, Web Forms, Web Services
Security 19
.NET Framework Consists of:
Oct 17, 2025
3. Common Language Runtime (CLR)
language-neutral development & execution
environment that provides common runtime for
application execution.
common compiler for all Microsoft programming
Event Driven Programming
language to one Machine Language.
allows programmers to write code in different
Microsoft languages of their choice, and ensure that
the parts can work together
In addition it provides programmers with services for
memory management, data types, security etc.
20
Common Language
Oct 17, 2025
Specification (CLS)
CLS 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
Event Driven Programming
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
21
Framework Base Class
Library (BCL)
Oct 17, 2025
Class Library is a comprehensive, object-oriented
collection of reusable types
These class library can be used to develop
applications that include:
Traditional command-line applications
Event Driven Programming
Graphical user interface (GUI) applications
Applications based on the latest innovations provided by
[Link]
22
Common Language Runtime
(CLR)
Oct 17, 2025
CLR ensures:
Establishes a framework that helps enable
A common runtime environment for all .NET languages
Uses Common Type System (strict-type & code-verification)
Memory allocation and garbage collection
Event Driven Programming
Intermediate Language (IL) to native code compiler. Which
Compiles MSIL code into native executable code
Security and interoperability of the code with other
languages
Over 36 languages supported today
C#, VB, Jscript, Visual C++ from Microsoft
Perl, Python, Smalltalk, Cobol, Haskell, Mercury, Eiffel,
Oberon, Oz, Pascal, APL, CAML, Scheme, etc.
23
Windows Forms
Oct 17, 2025
Framework for building rich clients.
Provides rapid application development
environment.
Event Driven Programming
Rich set of controls
Data aware
Printing support
Unicode support
UI inheritance
24
[Link]
Oct 17, 2025
Platform services that allow to program Web
Applications and Web Services in any .NET
language.
Uses .NET languages to generate HTML pages.
Event Driven Programming
[Link] “Program” is compiled into a .NET class
and cached the first time it is called. All
subsequent calls use the cached version.
[Link] has two components
1. Web Forms: a UI allows clean cut code
2. Web Services: A programmable application
component accessible via standard Web protocols
25
[Link] (Data and XML)
Oct 17, 2025
[Link] is a set of classes that expose data
access services for .NET Framework
programmers.
[Link] provides a rich set of components for
Event Driven Programming
creating distributed, data-sharing applications.
[Link] provides consistent access to data
sources such as SQL Server and XML, and to
data sources exposed through OLE DB and
ODBC.
Data-sharing consumer applications can use
[Link] to connect to these data sources and
retrieve, handle, and update the data that they 26
Compilation in .NET
Oct 17, 2025
Code in another
Code in [Link] Code in C# .NET Language
Event Driven Programming
Appropriate
[Link] compiler C# compiler Compiler
IL(Intermediate
Language) code
CLR just-in-time
execution
27
Intermediate Language (IL)
Oct 17, 2025
.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
Event Driven Programming
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.
28
Uses of .NET Platform in App.
Dev’t
Oct 17, 2025
– Provides a consistent object-oriented
programming.
– Provides a code-execution environment that
minimizes software deployment.
Event Driven Programming
– Provides a code-execution environment that
promotes safe execution of code.
– To provide a code-execution environment that
eliminates the performance problems of
scripted or interpreted environments.
– To make the developer experience consistent
across widely varying types of applications,
such as Windows-based applications and Web- 29
C# (C-Sharp)
Oct 17, 2025
– Microsoft C# (pronounced C Sharp) developed
by Microsoft Corporation, USA
– New programming language that runs on
the .NET Framework
Event Driven Programming
– C# is simple, modern, type safe, and object
oriented
– C# code is compiled as managed code
– Combines the best features of Visual Basic, C+
+ and Java
– Versionable
– Compatible
– 30
Introduction to Visual
Oct 17, 2025
[Link]
Development tool that contains a rich set of
productivity and debugging features.
Types of applications we can create include:
Event Driven Programming
Console Application – Usually Text only
application. Runs from a DOS or COMMAND PROMPT
screen.
Windows Application – Graphical Interface user
application. Typical Windows application that you
normally use, such as MS WORD etc.
Web Based Windows Application – Web
application that uses a Browser such as Internet
Explorer. 31
Oct 17, 2025
Visual Studio Environment
Integrated Development Environment (IDE)
Form Designer
Editor for entering code
Event Driven Programming
Compiler
Debugger
Object Browser
32
Visual Studio IDE Start Page
Event Driven Programming Oct 17, 2025
33
IDE New Project Dialog
Event Driven Programming Oct 17, 2025
34
Oct 17, 2025
IDE Main Window Components
Toolbars
Document Window
Form Designer
Solution Explorer
Event Driven Programming
Properties Window
The Name property of a control is used to refer to
the control in code.
The Text property holds the words that the user
sees on the screen.
Toolbox
Server Explorer,…
35
IDE Main Window
Event Driven Programming Oct 17, 2025
36
Oct 17, 2025
IDE Main Window Components
Solution Explorer
Presents a tree view
structure of files present in
the project.
Event Driven Programming
By default a New Website
will contain:
• An App_Data folder
• A [Link] page
(including [Link])
To view Solution Explorer:
Select View > Solution
Explorer
OR 37
Oct 17, 2025
IDE Main Window Components
Solution Explorer
The Toolbar at the top of Solution Explorer
enables various tasks.
Code
Event Driven Programming
Refresh Copy Website
View Designer
Properties
Nest Related Files [Link] Configuration 38
Oct 17, 2025
IDE Main Window Components
Toolbox
Holds the controls you place on a
form.
There are various tool tabs available in
the Toolbox.
Event Driven Programming
The controls in the IDE are presented
in a hierarchical manner (e.g.,
Standard Tab, Data Tab, Validation,
Navigation, WebParts etc.).
Depending on the type of project
(application) the toolbox tabs will vary.
To view the tool box:
Select menu View > Toolbox OR
Press buttons Ctrl+Alt+X or Ctrl+W, X
You can also view the controls as icons 39
Oct 17, 2025
IDE Main Window Components
Property Window
Used to view or change the properties
and events of a selected control during
design use the Properties Window
To configure a control:
Event Driven Programming
Click once to select it
Press F4 or Select menu View > Properties
window
Modify the appropriate properties in the
window
There are various options provided for
viewing the properties of the selected
control, such as:
Categorized view
Alphabetical view 40
Creating a Program in C#
Computer program is set of instructions which tell a computer what to do
Programmers do not use machine language when creating computer programs
Instead, tend to use high-level programming languages
Each high-level language has its own syntax and limited set of vocabulary that is
translated into machine code by a compiler
In addition to understanding syntax, a programmer must also understand
programming logic
C# program consists of the following parts:−
Namespace declaration
Class
Class methods
Class attributes
Main method
Statements and Expressions
Comments
41
Sample code
using System;
namespace HelloWorldApplication
{
class HelloWorld
{
static void Main(string[] args)
{
/* my first program in C# */
[Link]("Hello World");
[Link]();
} Output
}
Hello World!
}
42
Sample code …
Let us look at the various parts of the given program
Console is a class
“This is my first C# program” is a literal string of characters
using System;
using keyword is used to include the System namespace in the program
program generally has multiple using statements.
namespace declaration
is a collection of classes
HelloWorldApplication namespace contains the class HelloWorld
class declaration
HelloWorld class contains the data and method definitions that your program uses
Classes generally contain multiple methods
Methods define the behavior of the class
However, the HelloWorld class has only one method Main. 43
Sample code …
Let us look at the various …
Static
keyword which means object is not required to access static
members. So it saves memory.
Void
return type of the method
It does't return any value
In such case, return statement is not required
string[] args
used for command line arguments in C#
While running the C# program, we can pass values. These values are
known as arguments which we can use in the program. 44
Sample code …
Let us look at the various …
Main method
entry point for all C# programs
Whenever we run the C# program, Main() method is invoked first before any other
method. It represents start up of the program.
states what the class does when executed
Comment
/*...*/ is ignored by the compiler and it is put to add comments in the program
[Link]("Hello World");
WriteLine is a method of the Console class defined in the System namespace
This statement causes the message "Hello, World!" to be displayed on the screen.
[Link](); is for the [Link] Users
makes the program wait for a key press and it prevents the screen from running and
45
closing quickly when the program is launched from Visual Studio .NET
Compilation in .NET
Code in another
Code in [Link] Code in C# .NET Language
Appropriate
[Link] compiler C# compiler Compiler
IL(Intermediate
Language) code
CLR just-in-time
execution
46
Compilation and Execution by CLR
47
Compilation and Execution by CLR …
A program written in VB, C# or any of the .NET compliant
languages is compiled with their respective compilers to
produce .EXE or .DLL file, containing the IL code and
metadata, that can be saved on to a disk or deployed on the
internet.
Then execution, the IL code and any requested functionality
from the .Net base classes (libraries) is brought together.
The just in time (JIT) compiler processes the combined code
creating managed native code, which can be executed on
the host CPU.
Various JIT compilers are provided by the CLR, making it
possible for different computer architectures to execute IL.
48
Compiling & Executing Program
After creating source code, you must do the following before viewing program output:
Compile the source code into intermediate language (IL)
Use C# just in time (JIT) compiler to translate the intermediate code into executable
statements
If you are using Visual [Link] C# programs, take the ff steps −
Start Visual Studio
On the menu bar, choose File -> New -> Project.
Choose Visual C# from templates, and then choose Windows.
Choose Console/windows/web Application.
Specify a name for your project and click OK button.
This creates a new project in Solution Explorer.
Write code in the Code Editor.
Click the Run button or press F5 key to execute the project.
Command Prompt window or graphical user interface (GUI) window appears that contains code result
49
Practical Intro. To MS [Link]
Oct 17, 2025
2015
Creating Project Using the Integrated
Development Environment
Step 1: Open the Visual Studio IDE and invoke
the Start Page
Step 2a: In the Start Page, select New Project
Event Driven Programming
Step 2b: In the New Project Dialog select
Application Type
Step 3: The IDE Main Screen: varies depending
on which type of application you have selected,
Step 4: Set the Project Properties (StartUp
Object)
Step 5: Create your program using the
components of the IDE Main Screen.
Step 6: Compile or Build the Program. 50