Task compiling the codes, and checking the

Task 3                The
programming languages have to use the .NET framework’s features in executing
the output. .NET is composed of two main components.1)   
CLR – Common Language Runtime2)   
FCL – Framework Class Library CLR (Common language runtime)       What is CLR (Common language runtime)?          CLR is the
run-time environment that providing the development to be easier by running the
codes, compiling the codes, and checking the errors of the codes. The codes
that run with CLR are called the managed
codes. And the CLR provides code
compilation, memory management, exception handling, type safety, garbage
collection, and thread management. The CLR works as a layer between the Operating System and the program written
in the .Net. And the main function
of the CLR is to convert the managed codes into executable programs. The
versions of .Net Framework, CLR and visual studio

.Net Framework

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!

order now

CLR Version

Visual Studio



Visual Studio .NET





































 How does CLR works?Compiling            Language
Compilers (CIL) will convert the Code to Microsoft Intermediate
Language (MSIL). MSIL includes instructions for loading,
storing, initializing and calling methods on objects. The MSIL are compiled into the portable executable (PE). The PE
includes Metadata which has the
information about the PE like the version, languages, other data that the
runtime uses at the execution time, and what class library will be needed by
the program. And CLR uses the metadata for many purposes. The CLR uses the
metadata to load and to locate the classes, place layouts in the memory,
generate native code, and to make security. The metadata is used by JIT (Just-in-time) compilers to turn
into executable codes. The executing result may be dll or exe file. Executing            When the method is called for the first time, the
method’s MSIL has been generated and has JIT compiled into native code. And
instead of compiling all the codes in the assembly again, the native code is
stored in the memory. And if the method is run for the second time, the stored
native code is run instead of generating the MSIL again. Here is an illustration of the CLR process.


Source Code
(C#, F#, Etc.)

                                Language compiler                                                                                                                                                         JIT
Compiler (inside CLR)


Exe or Dll file
(Native Code)

                                                                                                                      Run on OS                                                                              Components of CLRMemory Management (garbage collection)          Memory management is one of the automatic service that the
CLR provides during the managed
execution. The memory is allocated by the CLR each time the developer
creates a new object. And it provides garbage
collecting (GC) – returning the no longer needed memory to the computer. This
means that the developers don’t need to write codes for managing the memory.
And the automatic memory management can solve many problems. Some are memory
leaking – forgot to return the memory, and trying to access the memory that
that already cleared.           The garbage
collector (GC) decides itself when to make a collection based on the
allocations. When the garbage collection performs a collection, it
automatically detects the objects that are no longer needed and perform
operations to recover the memory. The GC finds the no longer used objects by
examining the roots of the applications. By the way, every application has
roots which includes the static fields, parameters and variables. GC accesses the roots of the JIT-compiler
and makes a graph out of it. And by looking at the object life time in the
graph, it can eliminate the objects that are no longer used. Code compilation             The
C# program is loaded by the compiler and the compilation is started. The compilation compiles the source code into module. The module is used to produce
the assembly which contains the MSIL codes. And then the CLR takes the assembly
which contains the MSIL. The MSIL must be compiled to native code. There are
two ways to compile.1)   
.Net Framework
JIT (Just-in-time) compiler and 2)   
.Net Framework
Ngen.exe (Native Image Generator)The
great thing of JIT is that it converts the MSIL as less as needed during the
execution and stores the rest of the native code in memory instead of taking
time and memory to convert all the MSIL codes. The JIT-compiler takes the MSIL to compile into a native code. The native
code is stored in a heap. The native code compiled by the JIT compiler goes to
the OS Service and executed by them
to output in the GUI. The
bad thing is that the code generated by the JIT compiler cannot be shared
across multiple processes. To allow the
generated code to be shared across multiple processes, the common language
runtime supports the Ngen.exe to convert the MSIL into the native code just
the way like JIT compiler. But it has a little difference. 1)   
It compiles all the MSIL codes at only one time.2)   The compilation is done before running the program.Exception handling            The errors can happen while running the codes or
writing the codes. These errors can be passed back to the codes and unexpected
errors can happen. So, the exceptions
can be provided to your codes to detect those errors before they become big
errors. Exceptions allow you to build applications that make a call
to another function and then catch errors if they occur and handle them in the
called application. However, exception
handling are not the same from one programming language to another. And the
Common Language Runtime solves this problem for all applications.             SystemException is used for the
exceptions that are generated by the CLR.
And the ApplicationException is the class for exceptions that are thrown as
application. And the user can create
their own exceptions and extract from the ApplicationException class.            There are benefits of using the
managed Exception handling.1)   
The exceptions
can be thrown and caught in the both managed and unmanaged code and it
allows the user to use the exceptions outside of the environment he/she is
working in.2)   
The exceptions can be handled without the need for the same language
of the code that the exception is handling.3)   Exceptions
in CLR doesn’t require special syntax.4)   
Exception handling in CLR is faster than the C++
error handling.        FCL (Framework Class
Library)What is FCL?                                             FCL is the
library of the .NET Framework and contains classes, interfaces that are
reusable. FCL is where the .NET framework’s application, components are made. Framework class library contains
thousands of classes used to build different types of applications and provides
all the basic functionalities and services that application needs.  And the BCL (Base Class Library) provides
the most fundamental functionality of the FCL, such as System, System.Data, System.IO,   System.Resources, System.Text and etc.          FCL has many
cross-language technologies, and these includes file I/O, text management, .NET
framework security checking, providing data access and encapsulating the data
structures. It includes set of libraries, including Windows Forms, ADO.NET,
ASP.NET, Language Integrated Query, Windows Presentation Foundation, and
Windows Communication Foundation. And FCL includes a lot of classes and
services to support many applications such as 1)   
Mobile application2)   
Windows application3)   
Web application (ASP.net , WCF)4)   
Desktop application Functions of FCL
Classes           The FCL
includes the classes that support the functions as shown. 1)   
They can support for exception handlings.2)   
They can communicate with the underlying system.3)   
They have ability to create web-client and also
server applications. 4)   
They can connect with the databases and can
access data from them. 5)   
They can build Window-based GUI applications.6)   
They can support for creating web services.What is BCL?            The long term for BCL is base class library. It contains the classes that can be used in all
windows, web or mobile applications. The System namespace is the main of
the BCL and it contains the classes, interfaces and attributes that the other
parts depends on. BCL has all the common
used classes of the application such as web, mobile and windows. It is the
subset of the FCL.Example: the
method Console.WriteLine () is not usable in all applications since the WriteLine
() belongs to the Console Application. So, it is not in the BCL (Base Class
Library).System Namespace
hierarchy             .NET framework uses a dot syntax
naming scheme that makes a hierarchy.
And this technique sorts the related
types into namespaces so they can be easy to search and use.  Just like a folder can contain other
folders and documents, a namespace can contain other namespaces or classes.           All the
namespaces are stems from the common root called the System namespace. This namespace includes the classes that
represent the base data types that are used by all applications such as Object,
Array, Char, String, etc. And from the
System namespace, all other namespaces can be rooted from it. The first
part of the name before the dot (.) is the namespace name. And the last part of
the name is the type. For example:
System.Collections.Arraylist represents that the System.Collections is the namespace name and Arraylist is the
type that belongs to the System.Collections namespace.           The Framework class library can be extended
but the System namespace will contain the classes that are useful for all
applications. Main namespaces in
the .NET Class library




This contains the classes that defines that common values, reference data
types, events, event handlers, interfaces, math, and garbage collection and
application environment.


provides to support read and write data streams and files. And contains
classes like FileStream, and Directory.


This contains classes that defines objects such as arrays, and lists.


contains the classes that can implement child namespaces such as SqlClient which can be used to access the


This supports for processing the XML documents. And this includes child
namespaces such as Schema.


contains the types that are used in Windows
presentation Foundation (WPF) applications like animation clients, user
interface controls and data binding.


This contains classes that are used to create the windows applications.


Use for
access to the graphic functionality of GDI.
And contains the child namespaces such as Design, and Text.


This contains the classes that presents the .NET framework security and


enables the users to build and use the web services. And contains such
namespaces like Description, Discovery and Protocols.


This enables the users to build ASP.NET mobile web applications.


provides simple programming interface for
number of networking protocols.

 What is WCF (Windows
Communication Foundation)?             The windows communication foundation
is the framework for sending messages over service endpoints. The endpoint can
be the client of services that make request data from another end point. And
the message can be a simple XML word. So they have to use the System.Xml. Below
are some classes.

Class name



To implement a dictionary to optimize the WCF’s XML reader and writer.


implement a dictionary to optimize the WCF’s XML reader.


To implement a dictionary to optimize the WCF’s XML writer.

 What is WPF (Windows
presentation foundation)?            The wpf (Windows presentation
foundation) is for rendering the user interfaces in the windows based
applications. It is also based on the XML derivative making it easier to change
the UI and forcing the separation of UI and the core code.          With WPF,
developers can use the XAML (Extensible application markup language) to create
the custom controls, 3d graphics and animations. Silverlight

            Silverlight is an application
from Microsoft that can add 3D effects and cool designs to the web, mobile and
windows application. And they can developed by .Net Framework. The
System.Drawing can be used to develop the effects with Silverlight and child
namespaces of System.Windows can be used too.


I'm Isaac!

Would you like to get a custom essay? How about receiving a customized one?

Check it out