Académique Documents
Professionnel Documents
Culture Documents
Unit 1
1.3
1.4
1.5
1.6
1.7
1.8
1.9
1.10
1.11
1.12
1.13
Components of .NET
Common Language Specification (CLS)
Common Language Runtime (CLR)
Microsoft Intermediate Language ("MSIL" or "IL")
The Common Type System (CTS)
.NET Framework Base Classes
Web Services, Web Forms, and Windows Forms
The .Net Languages
Summary
Terminal Questions
Answers
1.1 Introduction
As you have already read the topics of OOPs with Java (Subject Code
BT 0074) covering programming with classes and objects, Website Design
(Subject Code BT 0078) covering the design and applications of a
Website, and Visual Basic (Subject Code BT 0082). These are the
prerequisites for you to understand the .Net Framework and usage of C#
language, which is a pure Object Oriented Language and have a
comfortable start with this subject.
The .NET Framework introduces a completely new model for the
programming and deployment of applications. .NET is Microsoft's vision of
"software as a Service", a development environment in which you can build,
create, and deploy your applications and the next generation of
components, the ability to use the Web rather than your own computer for
various services.
Microsoft introduced great technologies like COM, DCOM, COM+ etc., to
enable reuse of Software. Although these technologies are very powerful to
Sikkim Manipal University
Page No.: 1
C# Programming
Unit 1
Page No.: 2
C# Programming
Unit 1
The .NET Framework has two main components: the common language
runtime and the .NET Framework class library. The CLR is the foundation of
the .NET Framework. You can think of the runtime as an agent that
manages code at execution time, providing core services such as memory
management, thread management, and remoting, while also enforcing strict
type safety and other forms of code accuracy that promote security and
robustness.
In fact, the concept of code management is a fundamental principle of the
runtime. Code that targets the runtime is known as managed code, while
code that does not target the runtime is known as unmanaged code. The
class library, the other main component of the .NET Framework, is a
comprehensive, object-oriented collection of reusable types that you can
use to develop applications ranging from traditional command-line or
graphical user interface (GUI) applications to applications based on the
latest innovations provided by ASP.NET, such as Web Forms and XML Web
services.
The .NET Framework can be hosted by unmanaged components that load
the common language runtime into their processes and initiate the execution
of managed code, thereby creating a software environment that can exploit
both managed and unmanaged features. The .NET Framework not only
provides several runtime hosts, but also supports the development of thirdparty runtime hosts.
For example, ASP.NET hosts the runtime to provide a scalable, server-side
environment for managed code. ASP.NET works directly with the runtime to
enable ASP.NET applications and XML Web services, both of which are
discussed later.
Internet Explorer is an example of an unmanaged application that hosts the
runtime (in the form of a MIME type extension). Using Internet Explorer to
host the runtime enables you to embed managed components or Windows
Forms controls in HTML documents. Hosting the runtime in this way makes
managed mobile code (similar to Microsoft ActiveX controls) possible,
but with significant improvements that only managed code can offer, such
as semi-trusted execution and isolated file storage.
Page No.: 3
C# Programming
Unit 1
The Figure 1.1 below shows the relationship of the common language
runtime and the class library to your applications and to the overall system.
It also shows how managed code operates within a larger architecture.
Page No.: 4
C# Programming
Unit 1
ASP.Net
Web
Web
Services
Forms
ASP.NET Application Services
Drawing
XML
Security
Threading
IO
Diagnostics
Etc.
Common Type
System
Life Cycle
Monitoring
Page No.: 5
C# Programming
Unit 1
The .NET framework can only be exploited by languages that are compliant
with .NET. Most of Microsoft languages have been made to fully comply with
.NET.
.NET also introduces Web Forms, Web Services and Windows Forms. The
reason why they have been shown separately and not as a part of a
particular language is that these technologies can be used by any .NET
compliant language. For example Windows Forms is used by VC, VB.NET,
and C # all as a mode of providing GUI.
The next component of .NET is the .NET Framework Base Classes. These
are the common class libraries (much like Java packages) that can be used
by any .NET compliant language. These classes provide the programmers
with a high degree of functionality that they can use in their programs.
Example: Classes to handle reading, writing and manipulating XML
documents, enhanced ADOs etc.
The bottom most layer is the CLR.
Page No.: 6
C# Programming
Unit 1
The code that you develop with a language compiler targeting the runtime is
called Managed Code. It benefits from features such as cross-language
Sikkim Manipal University
Page No.: 7
C# Programming
Unit 1
Page No.: 8
C# Programming
Unit 1
the code written using any supported languages and finally convert it to the
required machine code depending on the target machine.
With MSIL, all the .Net applications would be compiled into a standard
common format and will interact with the .Net environment in a consistent
manner. The MSIL code is send to the CLR that converts the code to
machine language which is then run on the host machine. MSIL is similar to
Java Byte code.
Page No.: 9
C# Programming
Unit 1
interaction with various hardware devices, but it also provides support for a
number of services required by most real world applications.
Self Assessment Questions
6. Microsoft Intermediate Language (MSIL) is a platform independent
language that gets compiled into __________.
7. The common type system defines how ________ are declared, used,
and __________ in the runtime.
8. The .NET Framework class library is a library of classes, interfaces, and
_________ that are included in the Windows Software Development Kit
(SDK).
Page No.: 10
C# Programming
Unit 1
Page No.: 11
C# Programming
Unit 1
Data transfers are typically larger because of the fact that data is
transmitted in text-based XML formats.
Web services facilitate collaboration and allow businesses to grow.
By purchasing Web services and using extensive free Web services that are
relevant to their businesses, companies can spend less time developing
new applications.
Web Forms
Similar to how the Win Forms provide a unified way of developing GUI for
desktop applications, the Web Forms provide a similar tool for web
applications. Web Forms has been introduced in .NET as a part of
ASP.NET. Web Forms are a forms engine that provide a browser-based
user interface.
Web Forms consists of two parts - a template, which contains HTML-based
layout information for all the GUI elements and a Component which contains
all the logic to be hooked to the controls or GUI elements. This provides a
neat presentation layer and application logic layer separation.
The GUI will be rendered on the client side, while the code that has been
hooked to the GUI elements will run on the server side.
Another good feature of Web Forms is that it can be built to have enough
intelligence to support a vast variety of browsers. The same ASP page
would render itself using DHTML, if the browser is IE 5.5. but if the browser
is Netscape the web page will be rendered using HTML tags; if the page is
being accessed through a WAP device the same page will render itself
using WML tags. With ASP.NET Microsoft has provided such presentationbusiness layer separation by introducing the concept of Web Forms:
Window Forms
Windows Forms (also called Win Forms) are used to create GUI for
Windows desktop applications. The idea of Win Form has been borrowed
from Windows Foundation Classes (WFC) which was used for Visual J++.
Win Forms provide an integrated and unified way of developing GUI. It has
a rich variety of Windows controls and user interface support.
Page No.: 12
C# Programming
Unit 1
Page No.: 13
C# Programming
Unit 1
1.11 Summary
This unit has discussed the following topics:
1. The .NET Framework: The .NET Framework introduces a completely
new model for the programming and deployment of applications. .NET is
Microsoft's vision of "software as a Service", a development environment
in which you can build, create, and deploy your applications and the next
generation of components, the ability to use the Web rather than your
own computer for various services. This section discussed the basic
structure and usage of the .Net Framework with respect to C#
programming.
2. Components of .NET: The .NET framework can only be exploited by
languages that are compliant with .NET. Most of Microsoft languages
have been made to fully comply with .NET. .NET also introduces Web
Forms, Web Services and Windows Forms. This section described the
Page No.: 14
C# Programming
Unit 1
1.13 Answers
Self Assessment Questions
1. Re-usable, software
2. build, create, and deploy
3. Java Virtual Machine (JVM)
4. Mscoree.dll
5. Cross language interoperability
6. Dynamic Link Library (DLL)
7. types
8. value types
9. Windows Desktop Applications
10. Web Services
Page No.: 15
C# Programming
Unit 1
Terminal Questions
1. NET is Microsoft's vision of "software as a service", a development
environment in which you can build, create, and deploy your applications
and the next generation of components, the ability to use the Web rather
than your own computer for various services. (Refer Section 1.1)
2. Microsoft Intermediate Language (MSIL) is a platform independent
language that gets compiled into platform dependent executable file or
dynamic link library. (Refer Section 1.6)
3. CLR is .NET equivalent of Java Virtual Machine (JVM).The primary goal
of the CLR is to locate, load, and manage. (Refer Section 1.5)
4. Some of the main services provided by the CLR are Cross-Language
integration, cross - language exception handling, enhanced security,
versioning and deployment support, a simplified model for component
interaction, and debugging and profiling services. (Refer Section 1.5)
5. APL, C++, C#, Cobol, etc (Refer Section 1.4)
Page No.: 16