0% found this document useful (0 votes)
23 views14 pages

Unit 4

.NET is a software development framework by Microsoft that supports multiple programming languages for creating various types of applications, primarily on Windows. It includes components like the Common Language Runtime (CLR) for code execution and the .NET Framework Class Library (FCL) for reusable code. The framework has evolved from its original version in 2002 to include cross-platform capabilities with .NET Core and .NET 5+.

Uploaded by

Gulam Ansari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views14 pages

Unit 4

.NET is a software development framework by Microsoft that supports multiple programming languages for creating various types of applications, primarily on Windows. It includes components like the Common Language Runtime (CLR) for code execution and the .NET Framework Class Library (FCL) for reusable code. The framework has evolved from its original version in 2002 to include cross-platform capabilities with .NET Core and .NET 5+.

Uploaded by

Gulam Ansari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

UNIT-4 : .

NET OVERVIEW
INTRODUCTION TO .NET

The .NET Framework is a software development framework developed by Microsoft that


provides a runtime environment and a set of libraries and tools for building and running
applications on Windows operating systems. The .NET framework is primarily used on
Windows, while .NET Core (which evolved into just .NET starting from version 5) is cross-
platform. The framework supports multiple programming languages, such as C#, F#, and
VB.NET, and supports a range of application types, including desktop, web, mobile, cloud,
and gaming applications.
THE ORIGINS OF .NET
There are three significant phases of the development of .NET technology.
1. OLE Technology
2. COM Technology
3. .NET Technology

● OLE Technology: OLE (Object Linking and Embedding) is one of the technologies of
Microsoft’s component document. Basically, its main purpose is to link elements from
different applications with each other.
● COM Technology: The technology of the Microsoft Windows family of the operating
system, Microsoft COM (Common Object Model) enables various software components
to communicate. COM is mostly used by developers for various purposes like creating
reusable software components, linking components together to build applications, and
also taking advantage of Windows services. The objects of COM can be created with a
wide range of programming languages.
● .NET Technology: .NET technology of collection or set of technologies to develop
windows and web applications. The technology of .Net is developed by Microsoft and
was launched in Feb. 2002, by basic definition, Microsoft’s new Internet Strategy. It was
originally called NGWS (Next Generation Web Services). It is considered to be one of
the most powerful, popular, and very useful Internet Technology available today.
.NET FRAMEWORK OVERVIEWS
Main Components of .NET Framework
● Common Language Runtime(CLR):
o The CLR is the heart of the .NET Framework, acting as a virtual machine that
runs the code and manages various services such as memory management,
security, and thread management. Code that is compiled and executed within
the CLR is called “Managed Code,” while code that the CLR does not manage
is known as “Unmanaged Code.”
● .NET Framework Class Library (FCL):
o The FCL provides a large set of reusable classes and methods for application
development.
o This includes libraries for input/output operations, networking, data access, UI
controls, and more.

Overall, the .NET Framework is a powerful and versatile development platform that provides
a wide range of tools and libraries for building and running applications on Windows
operating systems.
● .NET is a software framework that is designed and developed by Microsoft. The first
version of the .Net framework was 1.0 which came in the year 2002. In easy words, it is a
virtual machine for compiling and executing programs written in different languages
like C#, VB.Net, etc.
● It is used to develop Form-based applications, Web-based applications, and Web services.
There is a variety of programming languages available on the .Net platform, VB.Net
and C# being the most common ones. It is used to build applications for Windows,
phones, web, etc. It provides a lot of functionalities and also supports industry standards.
● .NET Framework supports more than 60 programming languages of which 11
programming languages are designed and developed by Microsoft. The remaining Non-
Microsoft Languages are supported by .NET Framework but not designed and
developed by Microsoft.

.NET FRAMEWORK OVERVIEWS (A COMMON SUBSTRATEFOR


ALL DEVELOPMENT, KEYDESIGN GOALS, MEGA DATA,
MULTIPLE LANGUAGE INTEGRATION ANDSUPPORT, NAME
SPACES)
The .NET Framework is a software development platform developed by Microsoft,
primarily for building and running Windows applications. It's a managed environment that
provides services like memory management, security, and exception handling.

1. A Common Substrate for All Development


The .NET Framework serves as a unified platform for building different types of
applications:

Web applications (via ASP.NET)

Desktop applications (via Windows Forms or WPF)

Services (via WCF or Windows Services)

Mobile (older frameworks like Compact Framework; now evolved with .NET
MAUI/Xamarin)

It provides a Common Language Runtime (CLR) and a Base Class Library (BCL), which
serve as the foundation for all .NET applications.

2. Key Design Goals


Interoperability – Seamless integration with existing code, including COM and native code.

Portability – Initially for Windows, later evolved into .NET Core and .NET 5+ for cross-
platform support.
Security – Built-in mechanisms like Code Access Security (CAS) and validation.

Performance and Scalability – Managed execution, JIT compilation, and garbage collection
for efficient resource use.

Ease of Deployment – No need to register DLLs (no "DLL Hell"), support for side-by-side
execution.

3. Mega Data (Assumed to refer to Data Handling Capabilities)


ADO.NET – Handles database access and management (SQL Server, Oracle, etc.).

LINQ (Language Integrated Query) – Enables querying data in a consistent way (SQL, XML, objects).

Entity Framework – An ORM (Object Relational Mapper) for interacting with databases using .NET
objects.

Data Annotations and Data Binding – For building data-driven applications.

4. Multiple Language Integration and Support


Common Language Runtime (CLR) supports multiple programming languages:

C#, VB.NET, F#, C++/CLI, and more.

All .NET languages compile to a common Intermediate Language (IL) and run on the same runtime.

Enables language interoperability, i.e., components written in different languages can interact
seamlessly.

5. Namespaces
Namespaces are used to organize and group classes and other types in a logical hierarchy.

The System namespace is the root of the .NET Framework class library:

Example: System.IO, System.Collections, System.Net, etc.

They help avoid naming conflicts and allow better code organization and reuse.
.NET FRAMEWORK BASE CLASSES
The Base Class Library is a core set of reusable classes, interfaces, and value types that provide the
most fundamental functionality in .NET. It’s part of the larger .NET Framework Class Library (FCL)
and is used by all .NET applications, regardless of the language.

Key Features of BCL


Provides access to system-level functionality (I/O, threads, networking, collections, etc.)

Language-independent (usable from C#, VB.NET, F#, etc.)

Extensively tested and optimized

Supports object-oriented programming models

Major Namespaces in the BCL

Namespace Description

System Core types like Object, String, Int32, DateTime, Console, etc.

System.Collections Classic collections like ArrayList, Hashtable

System.Collections.Generic Generic collections like List<T>, Dictionary<TKey,TValue>

System.IO File handling: File, Stream, FileStream, StreamReader, etc.

System.Text Text manipulation, encodings, regular expressions

Examples of Base Classes


Object – Base class for all types

String – Immutable sequence of characters

Exception – Base class for exceptions

Array – Abstract base class for all arrays

Stream – Abstract class for byte streams


DateTime – Represents dates and times

Console – For console input and output

USER AND PROGRAM INTERFACES(USER INTERFACE, WINDOWS FORMS,


WEB FORMS, CONSOLE APPLICATION)
In .NET, developers can build different types of user interfaces (UI) and program interfaces
depending on the application type. These interfaces determine how users or other systems interact
with the application.

1. User Interface (UI)


This refers to the front-end part of an application where the user interacts with the software. .NET
provides several technologies to create user interfaces:

Windows Forms (WinForms)


Type: Desktop GUI application

Namespace: System.Windows.Forms

Features:

Drag-and-drop UI design in Visual Studio

Controls like buttons, labels, textboxes, grids, etc.

Event-driven model (e.g., button.Click)

Use Case: Internal business tools, Windows-only apps

Example UI:
csharp
CopyEdit
Button myButton = new Button();
myButton.Text = "Click Me";
myButton.Click += (s, e) => MessageBox.Show("Hello from WinForms!");
Web Forms
Type: Web-based UI (part of ASP.NET)

Namespace: System.Web.UI

Features:

Page-based model with .aspx files

Server-side controls (<asp:Button>, <asp:GridView>, etc.)

ViewState maintains UI state across postbacks

Use Case: Web applications hosted on IIS (older tech, now mostly replaced by MVC and Razor
Pages)

Example (ASPX):
html
CopyEdit
<asp:Button ID="btnClick" runat="server" Text="Click Me" OnClick="btnClick_Click" />

Console Applications
Type: Command-line interface (CLI)

Namespace: System

Features:

Text-based input/output using Console.ReadLine() and Console.WriteLine()

Simple and quick to develop

Use Case: Tools, scripts, automation, background services

Example:
csharp
CopyEdit
Console.WriteLine("Enter your name:");
string name = Console.ReadLine();
Console.WriteLine("Hello, " + name + "!");

2. Program Interface
This refers to how programs or systems interact with each other, often without direct user interaction.
Examples:
Class Libraries – Other programs can call into shared .NET assemblies (DLLs)

Web Services / APIs – Programs can interact over HTTP (WCF, Web API)

Event Handlers and Delegates – Programmatic communication within the application

COM Interop – Communicate with non-.NET components

Creating a Windows Forms Application Using Visual Studio 2017


First, open the Visual Studio then Go to File -> New -> Project to create a new project and then select
the language as Visual C# from the left menu. Click on Windows Forms App(.NET Framework) in the
middle of current window. After that give the project name and Click OK.
Here the solution is like a container which contains the projects and files that may be required by the
program.
After that following window will display which will be divided into three parts as follows:
Editor Window or Main Window: Here, you will work with forms and code editing. You can notice
the layout of form which is now blank. You will double click the form then it will open the code for
that.
Solution Explorer Window: It is used to navigate between all items in solution. For example, if you
will select a file form this window then particular information will be display in the property window.
Properties Window: This window is used to change the different properties of the selected item in the
Solution Explorer. Also, you can change the properties of components or controls that you will add to
the forms.
Now to add the controls to your WinForms application go to Toolbox tab present in the extreme left
side of Visual Studio. Here, you can see a list of controls. To access the most commonly usecontrols
go to Common Controls present in Toolbox tab.

Now drag and drop the controls that you needed on created Form. For example, if you can add
TextBox, ListBox, Button etc. as shown below. By clicking on the particular dropped control you can
see and change its properties present in the right most corner of Visual Studio.

In the
above image, you can see the TextBox is selected and its properties like TextAlign, MaxLength etc.
are opened in right most corner. You can change its properties’ values as per the application need. The
code of controls will be automatically added in the background. You can check
the Form1.Designer.cs file present in the Solution Explorer Window.
To run the program you can use an F5 key or Play button present in the toolbar of Visual Studio. To
stop the program you can use pause button present in the ToolBar. You can also run the program by
going to Debug->Start Debugging menu in the menubar.
C# Windows Forms is a graphical user interface (GUI) framework that enables developers to create
desktop applications for the Windows operating system. Windows Forms applications are created
using the C# programming language and the .NET framework. They are built by dragging and
dropping controls such as buttons, text boxes, labels, and other user interface elements onto a form.
The Windows Forms framework provides a rich set of controls that developers can use to build
applications with. These controls are designed to provide a consistent and familiar user interface for
Windows users. Developers can customize the appearance and behavior of these controls by setting
various properties and handling events.
To create a Windows Forms application in C#, you can use Microsoft Visual Studio, which is an
integrated development environment (IDE) that provides a visual designer to create and layout the
user interface elements. The visual designer is a drag-and-drop interface for building your UI, and you
can easily configure each control’s properties through a user-friendly interface.
In addition to the visual designer, Visual Studio also provides a code editor that enables developers to
write the C# code for the application’s logic. Developers can handle events and perform tasks such as
data validation, data manipulation, and business logic implementation.
Windows Forms applications are versatile and can be used to create various types of applications such
as data entry, management, and reporting applications, as well as games and multimedia applications.

PROGRAMINTERFACE, WEBSERVICES
A program interface is how one program or system communicates with another. In .NET, this is often
done using:
Web Services
APIs (Application Programming Interfaces)
Class Libraries (DLLs)
COM Interop (for older Windows applications)
These interfaces are typically non-visual, used behind the scenes by applications to exchange data or
perform tasks.

Web Services in .NET


A Web Service allows applications to communicate with each other over the web using standard
protocols like HTTP, XML, and SOAP.

🔧 Types of Web Services in .NET

1. ASMX Web Services (SOAP-based)


Technology: Introduced in early versions of .NET
Protocol: SOAP (Simple Object Access Protocol)
Extension: .asmx
Namespace: System.Web.Services
Data Format: XML
Features:
Platform-independent
Uses WSDL (Web Services Description Language) to describe the service
Easily consumed by .NET and non-.NET clients
Example:
csharp
CopyEdit
[WebService(Namespace = "http://example.com/")]

public class CalculatorService : WebService {


[WebMethod]

public int Add(int a, int b) {


return a + b;
}

Client-side usage: You can add a Web Reference in Visual Studio and call the service like a local
method.

2. WCF (Windows Communication Foundation)


More advanced and flexible than ASMX
Supports multiple protocols: HTTP, TCP, MSMQ, Named Pipes
Serialization formats: XML, JSON, Binary
Namespace: System.ServiceModel
Benefits:
Security
Reliability (message queuing)
Transactions
Multiple endpoints (e.g., REST + SOAP from the same service)
Example:
csharp
CopyEdit
[ServiceContract]

public interface ICalculator {


[OperationContract]

int Add(int a, int b);


}

public class CalculatorService : ICalculator {


public int Add(int a, int b) => a + b;
}

Configuration: Often done via app.config or web.config.


3. Web API (RESTful Services)
Introduced in ASP.NET Web API, now merged into ASP.NET Core
Protocol: HTTP/HTTPS
Data Format: JSON or XML (default is JSON)
Stateless, lightweight, and ideal for modern web apps and mobile apps
Example:
csharp
CopyEdit
[Route("api/[controller]")]

public class CalculatorController : ApiController {


[HttpGet]
public int Add(int a, int b) => a + b;
}

Client usage: Can be called from browsers, mobile apps, or tools like Postman or curl.

🧠 Key Differences

Feature ASMX Web Services WCF Web API

Protocol SOAP (XML) SOAP, TCP, HTTP, more HTTP (RESTful)

Format XML XML, JSON, Binary JSON (default), XML

Complexity Simple Complex but flexible Simple and modern

Ideal Use Case Legacy systems Enterprise apps Mobile & web apps

You might also like