In the previous discussion we talked about the basic fundamental topics of .Net which included topics such as IL Code, why do we need IL code, how does IL code looks like, CTS(Common Type System), how to create a new project by using Visual Studio software.

Now moving forward towards our next discussion where we will talk about some other fundamental topics.

PerfMon :-

PerfMon is known as “Performance Monitor”. It is a tool which is used to determine the performance of the machine with respect to memory, hard drive, etc. By using this tool we can monitor how much memory is consumed when any application is run on the machine.

This tool is used by going to the Command Prompt of the computer and then writing the tool name as “PerfMon”. We can get the output in Line, Histogram Bar and Reports (Numbers).



This is how PerfMon tool looks like.


Now as we previously discussed that JIT is compiling the code into machine code for execution of the application.

So discussing further JIT is known as Just In Time compilation. The main function of JIT is to check the Machine environment and according to that compile the IL code into an optimal machine code or language for execution. Now there are 3 types of categories of JIT which are:

  1. Normal JIT:- This is a regular kind of JIT where only those methods are compiled which are called at runtime. Where these methods are compiled first and then stored into cache memory. So now whenever we want to call those methods, they will take the compiled code from the cache memory and then execute it as JIT will not compile the code again and again as it is stored in cache memory.
  2. Pre – JIT:- In this kind of JIT the compilation of code is done in the beginning itself when the application is installed or deployed. It compiles the complete code into native code within one compilation cycle. Pre JIT can be implemented using ngen.exe tool.
  3. Econo JIT:- This kind of JIT also works like Normal JIT where methods are called and compiled at runtime. But here the compiled code is not stored in cache memory. So now every time we call the methods the code will compile at runtime. The use of this kind of JIT makes sure that the RAM is utilized in an optimal manner. The Econo JIT is used mainly in mobile applications as mobiles don’t have much RAM.

Ngen exe. :-

Ngen also known as Native Image Generator. The main function of ngen.exe is to compile full .Net native code and store it in the cache memory. Now instead of compiling the code on runtime every time, a full image of the compiled native code is stored in cache memory while installing the application so that every time we run an application it uses the compiled code stored in cache. Due to this the performance is better and application will execute faster.


DLL’s are known as Dynamic Link Libraries. These dll’s are formed along with the exe files when we run the code. These dll’s are used for linking the codes during runtime.


EXE files are known as execution files. The only function of exe files is to execute a program or application. When we double click the exe file of an application, it executes the application that’s it nothing more these exe files can do.

Now to understand the concept of CLS, the explanation of dll’s and exe files is already done. So moving forward to the next topic:


CLS is also known as Common Language Specification. So the CLS is a set of rules or we can say guidelines, where any programming language follows these set of rules they can be consumed by any .Net languages. So as we already discussed about CTS in previous session whose function was to form a common data type between .Net languages to ensure smooth communication. From the functions of CTS and CLS we come to know that CLS is a subset of CTS. The linking of code from one language to other is done through dll’s.

For eg. C# language is case sensitive whereas VB.Net language in not case sensitive. So if we declare two methods with the same name but only with case difference “add” & “ADD” in C# and then run this code in VB.Net, VB.Net language will be confused as it is case insensitive and will not execute the code. Therefore this code will be a CLS non-compliant code as it does not follow set of rules of CLS.


CLR is known as Common Language Runtime. CLR is a stage which is between IL code and JIT. We can also say that it is the heart of the .Net frame work because it performs 4 primary tasks before giving the code to the JIT for compilation and execution. These 4 tasks are given below:

  1. Garbage Collection
  2. CAS (Code Access Security)
  3. CV (Code Verification)
  4. IL to native translation.

Now from these tasks we will be discussing CAS in this part of discussion.


Now as we know that CAS is called Code Access Security. So the question arises that why do we need CAS before compilation of code through JIT?

As the name is code access security its main function is to make sure that the code which we are using has the full permission or full authority to run on the machine where we will be running the code.

Whether the code is written in the same machine environment or it is taken from somewhere like downloaded from the internet, the CAS makes sure that the code has appropriate rights or permission to run. It is part of a security model of .Net which determines whether the code has appropriate rights or not.

Methods in C#:-

Methods are defined as code block which contains a series of statements. In a program if we want to execute a particular statement we have to call for a specific method. In C# every executed instruction is performed in the context of a method. Methods describe the objects abilities.

For eg. Monkey has ability to Jump. So Jump()is one of the method.

Data Types in C#:-

As we know that C# is a strongly type language which means that we cannot use variables without using datatypes.

Data types tell the compiler which type of data is being used. For eg. If we want to use string variable then we have to define string data type, if we want to use integer variable then we have to use integer data type.

Therefore C# provides 2 type of data types:

1) Value Type:- In this the data type stores the copy of the value. Examples of this value type are, Int, Char, Decimal, Float, Double, bool, etc.

Lab2.32) Reference Type:-  In this the data type stores the address of the value. Examples of this reference type are, string, object.



Casting is a mechanism or a process whose main function is to convert one type of data to other type of data. It is also sometimes termed as “Conversion”. Now there are 2 types of casting which are given as follows:

1 ) Implicit Casting:- In this type of casting or conversion, one type of data is converted to other type easily. It means that any lower type of data can be moved to upper type without any loss of data.

For eg. We can simply move an integer type data to a double type without any loss.

int i = 100;

double d = 0;

d = i;    //  implicit casting

Here we moved integer value 100 to double we get the 100 value as it is without any loss. This is termed as Implicit casting.

2 ) Explicit Casting:- In this type of casting or conversion, one type of data is converted to other type but not so easily because for completion of this casting we need to explicitly specify the casting or conversion. Here data loss occurs as we are trying to move upper type of data into lower type.

For eg. We consider moving double type of data into a integer type.

double = 100.77;

int i = 0;

i = (int) d; //  explicit casting

Here we moved double value 100.77 to integer value 100, as we see that .77 is removed or we can say loss of that data. This is termed as Explicit Casting.

Now some times what happens is that we try to move one type of data to other type by using implicit and explicit casting but still we cannot move the data and it shows error. At this time we can bring the concept of “Convert”

Convert:-  We can also call this convert type of casting as Forced Casting.

Here if we want to move one type of data to other and we have tried to use explicit casting but still it is not working then we have to use this Convert function.

For eg.Convert.Todouble, Convert.Toint, etc.

Object Oriented Programming (OOPS):-

Sometimes while writing a big program it happens that we have to create so many functions and methods which in the long run become difficult to memorize, it becomes tedious job for writing a code and the purpose for which we are creating the program or the application gets side tracked and we only think about the methods & functions.

Therefore to overcome these hurdles Object Oriented Programming was introduced. In this type of programming various classes and objects are created which can be mapped to the real world objects. It is a software designing technique where we think in terms of real world objects.

For eg. If there is a Bus in the real world we can create a class called bus in the program, if we have a conductor or a ticket checker in real world then we can create an object called as conductor or ticket checker in the class called Bus.

We can create multiple objects in the same class and these objects can be individual objects or they can inherit properties from other objects by creating a relationship between the objects. Sometimes while writing the code we can create a class that doesn’t need to be changed when a new type of object is added.

Now the question arises what are class and objects?

Defining them accurately we know that,


Class is a collection of Templates. Or we can say that Class is an instance of Real World


We can say that Object is an instance of Class.