Today in Engineer's World, we
are discussing a very important topic of C# -String
in very easy way. Posted By- +LIVE VIAR +Manish Kumar Gautam +ASP.NET SOLUTIONS
Click imagination
hunt to see latest Blogs
Previous
- What is .NET OR .NET Language?
Q- Define .NET Framework?
DEFINITION: .Net Framework is a platform for set of Libraries, Utilities, Compilers which we can used for Developing, Building and Deploying various .Net Application.
.Net Applications like
o
Windows
Form Application
o
Web
Application
o
Console
Application
o
WCF
Application
o
WPF
Application
o
Silverlight
Application
.NET Framework Architecture
Q- EXPLAINING
THE COMPLETE ARCHITECTURE OF .NET FRAMEWORK?
.Net Framework Architecture |
The process
starts with the compilation of the code written for example in C# by their language compilers (CSC
which is C# Compiler) into Intermediate Language (IL). The IL code and the
resources are stored on a disk in an executable file called an assembly, with
an extension of .exe
and .dll. We talk about .exe and .dll in our
later blogs. Just for now make a rough idea that .exe
and .dll are extensions in which IL information
is stored. It is the file that provides information about the assembly name,
version number, culture information, public key token and process architecture.
Now, have a look according to Figure 1 we are completed with the first two
steps. Now, what happen in the next step is when our C# code is executed
successfully, the assembly is loaded into the CLR. CLR serve as an execution engine for the IL code whose
responsibility is to check the functioning of the code on the behalf of CLS and
CTS (check the details of CLS and CTS at the below subheading points of their
own). Now, when the requirements are met CLR performs the Just In
Time (JIT) compilation to convert the IL code to
machine code which is understandable by the Operating System of the client
machine.
Compilation work in .NET
Q-HOW DOES THE
COMPILATION WORK STARTS IN .NET FRAMEWORK?
Compilation in .NET Framework |
Source code is compiled in
Intermediate Language (IL) by their own language compiler. See the Figure (2)
and proceed step by step.
Suppose a Developer choose to
write a code in any language let's say we are taking two language
code C# and VB. Now the code is compiled by its language compiler into
Intermediate Language Code (IL). It means every .Net language has its own
language compiler so that it may compiled into IL.
Now the question is what is
this IL Code? Why we inserted or using this in our figure. IL is half (1/2)
compiled code and is same for every language.
IL is the lowest-level human readable programming language used by the .NET
Framework. For ex- Take Vb Code (in column 1) and C# Code (in column 2)
both returning the same
output but the syntax is different as you can see in Figure 3. Means Data-types
are different their declaration is different there casting styles is different.
We are using a different syntax for Vb.Net Code and completely different syntax
for C# Code. But, now what happen is VSC will compile the Vb.Net code into IL
and similarly the CSC will compile the C#
code into IL. Now, when you look into the IL Code, it will be same for both the
source code. That means there is no two different source code. We have only one
single source code, which is IL. This is How the compilation is done from
source code to Intermediate Language (IL) code. Next we read about IL.
IL
Q- WHY IL IS
REQUIRED?
Let just understand this by
using an example-
Suppose we have to develop an
Internet Video Downloader Application for a particular client.
Things to keep remember:
While developing and building
we should know about the specification for the client machine.
o
What
type of computer he has?
o
What
type of Operating System (O.S.) use by them?
o
What
type of RAM he has?
o
What
type of process he has?
Because machine
code completely dependent on the specification of the computer. A normal
machine doesn't know about IL code or CSC code or VBC code it only and only understands
machine language. And the developer is totally unaware of the client machine as
both are at different locations. So it is not possible for any developer to
tackle this problem. So, Microsoft introduces the concept CLR that is the execution engine for .NET application and it
serve as the interface between Application and O.S. So, that's why the language
compiler convert the source code into IL. This IL is taken by JIT (JUST IN TIME COMPILER). Wait... and see the Figure 4 to
proceed and understood. It’s the JIT who took the responsibility who convert
the IL code into the machine code. Now this JIT at run-time convert the IL code into machine code which
actually getting executed according to the client machine configuration. IL is
also known as MSIL and CIL i.e., Microsoft Intermediate Language and Common
Intermediate Language.
CLR
Q- WHAT IS CLR?
CLR: CLR is the
run-time environment that execute MSIL code. CLR takes the compiled code IL and pass it to the JIT
compiler. Now, JIT convert it to machine code. And this machine code is
understandable by the Operating system. CLR consist of CTS and CLS.
CTS
Q- WHAT IS CTS?
CTS: CTS is Common Type
Specification. Now suppose we have to consume some VB.Net code into C# code. So
to make it possible, we need CTS.
So the question is can we change the data type from VB.Net to C#? The answer is
Yes, because both the data type is derived from CTS. For ex- Integer in VB.Net
and “int”
in C# both are derived from System.Int32. So this is what we call Common Type
System/Specification. CTS contain CLS.
CLS
Q- WHAT IS CLS?
CLS: CLS is Common Language
Specification. CLS
define set of rules which every .Net compliant languages must follow. For ex-
there are some rules which both the languages C# and VB.Net must follow so as
to easy communicate with each other. Like- put proper casing for variable
declaration. As a and A are considered as same variable in VB.Net but it is
counted as two different variable in C#.
So while writing C# code we should care that, if we declare two variables with
same name but with different casing. Then, it is not possible for VB.Net application
to consume that library.
BCL
Q- WHAT IS BCL?
BCL (Base Class
Library):
Now, if you want to communicate with the database. It is not required to write
each and every line like how the compilation works in depth.
If you want to read or write
any file stored in the local disk, you are not required to write the complete C
level coding.
There are some classes available like files. Just create object for these classes
and use it.
So, these are some reusable
libraries available in BCL in .Net
Framework itself. We can use them and proceed with our work. We are not
required to waste our time which is already been done.
FCL
Q- WHAT IS FCL?
FCL (Framework
Class Library):
The FCL is a collection of over 700 classes and data types that enables .Net
application to read and write files, access databases, process XML, display a
graphic a graphic user interface, draw graphics, use web services, etc. The FCL
wraps much of the massive, complex Win32 API into simpler .Net object that can
be used by c#
and other .Net Programming languages.
.NET TOOLS
Q- WHAT ARE
.NET TOOLS?
.NET TOOLS: Visual Studio .Net is
Microsoft own Tool. It provides an Integrated Development Environment (IDE). It
helps Developers to built Windows Application, Web Application and Web Services
running on any platform that supports .Net.
For any query, comment us
below.
Next - FEATURES OF .NET FRAMEWORK
Keep learning and sharing...
This comment has been removed by a blog administrator.
ReplyDeleteI am glad to hear that.
DeleteThank you Mohana M
This comment has been removed by a blog administrator.
ReplyDelete