Thursday, September 23, 2010

Out type parameters and Reference type parameters:

The Microsoft newly introduced out parameters in the c#.net, Using out Parameters we can send formal parameter value into the Actual parameter, while working with the out type parameters we have to initialize values to the formal parameters, out type parameters function can returns collection of values.

It’s very hard to get understand the above sentence let me explain you with example.  First I will show you a code which includes a class and view variables.

class Student
    {
        static void Main()
        {
            Number abc = new Number();
            int i=1000;
            abc.Calc(i);
            Console.WriteLine(i);

            Console.Write("Press any key to continue...");
            Console.ReadKey();
        }

        class Number
        {
            public void Calc(int i)
            {
                Console.WriteLine(i);
                i = 2000;
            }
        }
      
    }

OutPut
1000
1000

Here “abc” is an object that looks like “Number” class created. Variable “i” is initialized to a value 100. So using “abc” object we are calling “Calc” method with one parameter. Here i am sending value 100 when I call “Calc” method from Main() and display the value inside the “Calc” method.

Again while going back to Main() i assigned a value to “i=2000” and then WriteLine will display the value 1000 again. By this example if we change the variable name in the method “Calc” it wont effect the variable in Main() method.

So to retrieve this requirement microsoft introduce this concepts.

Here below code explains you first program using out parameter with error.

class Student
    {
        static void Main()
        {
            Number abc = new Number();
            int i=1000;
            abc.Calc(i);
            Console.WriteLine(i);

            Console.Write("Press any key to continue...");
            Console.ReadKey();
        }

        class Number
        {
            public void Calc(out int i)
            {
    Console.WriteLine(i);
                i = 2000;
            }
        }
      
    }

Error
Error 1 The best overloaded method match for 'ConsoleApplication2.Student.Number.Calc(out int)' has some invalid arguments
Error 2 Argument '1' must be passed with the 'out' keyword
Error 3 Use of unassigned out parameter 'i'

The above code is same as our previous one. I just added a “out” keyword in “Calc” function. This “out” keyword indicates what ever the changes made to “i” in “Calc” function that should return to Main(). But here we forgot put “out” keyword in calling function “abc.Calc(i);” so its throwing error. We need to mention “abc.Calc(out i);” to retrieve by this error as shown below code and with little modification.

class Student
    {
        static void Main()
        {
            Number abc = new Number();
            int i=1000;
          
            Console.WriteLine(i);
            abc.Calc(out i);
            Console.WriteLine(i);

            Console.Write("Press any key to continue...");
            Console.ReadKey();
        }

        class Number
        {
            public void Calc(out int i)
            {
                i = 2000;
            }
        }      
    }
OutPut
1000
2000

Hence the variable “i” changed to 2000 Great. But in the previous code I am trying to display in Calc method and that through an error because when you mention “out” in the method parameters then it won’t take “in”. Like try to change “i=2000” to “i=i+2000”. It will through you an error (unassigned).

To retrieve this particular requirement Microsoft introduced Reference type parameters.

Reference type parameters:
Using reference type parameters we can send actual parameters. Address into the formal parameters, In the reference type parameters formal parameters modifications effects in the actual parameters, As per C#.Net we can get the variable address, we can send the variable address. Using “ref” keyword.

This also explained with examples. Let’s change “out” to “ref” in the above program.

class Student
    {
        static void Main()
        {
            Number abc = new Number();
            int i=1000;
          
            Console.WriteLine(i);
            abc.Calc(ref i);
            Console.WriteLine(i);

            Console.Write("Press any key to continue...");
            Console.ReadKey();
        }

        class Number
        {
            public void Calc(ref int i)
            {
                i =2000;
            }
        }      
    }

OutPut
1000
2000

Same as above, But as I told you we are getting an error when I am trying to use “I” in the “Calc” method like “i=i+2000”. Let’s try this using “ref” in the function.

class Student
    {
        static void Main()
        {
            Number abc = new Number();
            int i = 1000;

            Console.WriteLine(i);
            abc.Calc(ref i);
            Console.WriteLine(i);

            Console.Write("Press any key to continue...");
            Console.ReadKey();
        }

        class Number
        {
            public void Calc(ref int i)
            {
                i = i + 2000;
            }
        }
    }

OutPut
1000
3000

Wow, it solved our error.

 Let me show the drawback of “ref” parameter as shown below code.

class Student
    {
        static void Main()
        {
            Number abc = new Number();
            int i;

            abc.Calc(ref i); //Error
            Console.WriteLine(i);

            Console.Write("Press any key to continue...");
            Console.ReadKey();
        }

        class Number
        {
            public void Calc(ref int i)
            {
                i = 1000;
                i = i + 2000;
            }
        }
    }

Error
Error 1 Use of unassigned local variable 'i'

So, by this we came to know while working on ref parameter we need to send value too. But for out parameters there is no use to send value.

Sunday, September 19, 2010

Arrays in Console Application/C#

Arrays in Console Application/C#
All programming languages come across the concept of arrays. So this is very important. Basically arrays are used to store a group of data which are having same data type. I will few examples of arrays in this post.
class abc
    {
        static void Main()
        {
            int[] array;
            array = new int[3];

            array[0] = 1;
            array[1] = 2;
            array[2] = 3;

            Console.WriteLine(array[0]);
            array[0]++;
            Console.WriteLine(array[0]);
            ++array[1];
            Console.WriteLine(array[1]);

            int i=1;
            Console.WriteLine(array[i]);
            i = 5;
            Console.WriteLine(array[i]); //Error
            Console.ReadKey();
        }
Error:
Index was outside the bounds of the array.
We declare arrays with a set of [] brackets. As our example int[] array means array is like of int[].  And instantiate array with new keyword. Number 3 in the square bracket indicate that the user want to store 3 items or 3 records. Hence in the array the items count/index start at ‘0’ and end at ‘n-1’. As shown in the example it starts at ‘0’ and end at ‘2’. But we are trying to pull the record that is not created so we got this error.


static void Main()
        {
            int[] array;
            array = new int[3];

            array[0] = 1;
            array[1] = 2;
            array[2] = 3;

            Console.WriteLine(array[0]);
            array[0]++;
            Console.WriteLine(array[0]);
            ++array[1];
            Console.WriteLine(array[1]);

            int i=1;
            Console.WriteLine(array[i]);
            i = 2;
            Console.WriteLine(array[i]); //Error
            Console.ReadKey();
        }


OutPut
1
2
3
3
3

Hurry! No errors, It looks we are having more code with similar content lets use loop concept to minimize the code. As shown below

class abc
    {
        static void Main()
        {
            int[] array;
            array = new int[3];
            int i;
            for (i = 0; i < 3; i++)
                array[i] = i + 1;

            for (i = 0; i < 3; i++)
                Console.WriteLine(array[i]);

            Console.ReadKey();
        }
    }

OutPut
1
2
3

Hence we minimized the code and removed all errors. Now we will see how ‘foreach’ works with same code. As shown below.
class abc
    {
        static void Main()
        {
            int[] array;
            array = new int[3];
            int i;
            for (i = 0; i < 3; i++)
                array[i] = i + 1;

            foreach(int p in array)
                Console.WriteLine(p);

            Console.ReadKey();
        }
    }
OuPut
1
2
3

Constructor and Destructor

by Emmaneale Mendu
Constructors:

Constructors are nothing but methods that are called automatically at the time of birth or creation of the object. This should have a name, same to the class name. Let see with an example.


class abc
    {
        static void Main()
        {
            xyz a = new xyz();

            Console.ReadKey();
        }
    }

    class xyz
    {
        public xyz()
        {
            Console.WriteLine("I am Constructor");
        }
    }

OutPut
I am Constructor

Above example you see class 'xyz' as a method with same name that constructor so when an object is created for 'xyz' then xyz() method called automatically. Let’s try this differently as shown below.

class abc
    {
        static void Main()
        {
            xyz a = new xyz();
            a.xyz(); //Error

            Console.ReadKey();
        }
    }

    class xyz
    {
        public xyz()
        {
            Console.WriteLine("I am Constructor");
        }
    }

Error 1 'ConsoleApplication2.xyz' does not contain a definition for 'xyz' and no extension method 'xyz' accepting a first argument of type 'ConsoleApplication2.xyz' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\emendu\My Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\Program.cs 13 15 ConsoleApplication2

Oops! Error, by seeing we came to know that we cannot call constructor manually. OK

Destructors:

A destructor is also a method/function with the same name as class name like constructor but basic difference is

Constructor = ‘public method_name()’
Destructor = ‘~method_name()’

Explanation wise, a constructor gets called at birth whereas a destructor gets called at death.

Move forward and check example to get brief idea.

class abc
    {
        static void Main()
        {
            xyz a = new xyz();

            Console.ReadKey();
        }
    }

    class xyz
    {
        public xyz()
        {
            Console.WriteLine("I am in Constructor");
        }

        ~xyz()
        {
            Console.WriteLine("I am in Destructor");
        }
    }

OuPut
I am in Contructor
I am in Destructor

Thursday, September 16, 2010

Console Namespace

by Emmaneale Mendu
 Well, we are done with basic part of classes, by now everyone will know how to use classes. And in this post we will work on a new topic namespaces. Like classes we can have any number of namespaces in our program.
A namespace is nothing but a word and with open brace and close brace. The entire class and group of classes are enclosed within the namespace. Example: as shown below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class abc
    {
        static void Main()
        {
          
        }
    }

    namespace ns1
    {
        class ns1_class
        {
          
        }
    }

    namespace ns2
    {
        class ns2_class
        {
          
        }
    }
}

namespace Consol
{
    class Consol_class
    {
      
    }
}
Here you two main namespaces ‘ConsoleApplication2’ and ‘Consol’and inner namespaces with having group of classes.
I will show you the errors and solutions later in this post.
namespace ConsoleApplication2
{
    class abc
    {
        static void Main()
        {
            ccc();
            aaa();
            bbb();
          
            Console.ReadKey();
        }

        public static void ccc()
        {
            Console.WriteLine("I am in CCC");
        }      
    }

    namespace ns1
    {
        class ns1_class
        {
            public static void aaa()
            {
                Console.WriteLine("I am in AAA");
            }
        }
    }

    namespace ns2
    {
        class ns2_class
        {
            public static void bbb()
            {
                Console.WriteLine("I am in BBB");
            }
        }
    }
}
Errors:
The name ‘aaa’ does not exist in the current context.
The name ‘bbb’ does not exist in the current context.

In the above example program we are calling methods aaa() and bbb() which are in other namespaces. We need tell to the machine from which namespace the method is called. Like as shown in the below code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class abc
    {
        static void Main()
        {
            ns1.ns1_class.aaa();
            ns2.ns2_class.bbb();
            ccc();
          
            Console.ReadKey();
        }

        public static void ccc()
        {
            Console.WriteLine("I am in CCC");
        }      
    }

    namespace ns1
    {
        class ns1_class
        {
            public static void aaa()
            {
                Console.WriteLine("I am in AAA");
            }
        }
    }

    namespace ns2
    {
        class ns2_class
        {
            public static void bbb()
            {
                Console.WriteLine("I am in BBB");
            }
        }
    }
}

OutPut
I am in AAA
I am in BBB
I am in CCC

Now we will little different way to call the other namespace methods adding using’s.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ns1;
using ns2;

namespace ConsoleApplication2
{
    class abc
    {
        static void Main()
        {
            ns1_class.aaa();
            ns2_class.bbb();
            ccc();
          
            Console.ReadKey();
        }

        public static void ccc()
        {
            Console.WriteLine("I am in CCC");
        }      
    }  
}

namespace ns1
{
    class ns1_class
    {
        public static void aaa()
        {
            Console.WriteLine("I am in AAA");
        }
    }
}

namespace ns2
{
    class ns2_class
    {
        public static void bbb()
        {
            Console.WriteLine("I am in BBB");
        }
    }
}

OutPut
I am in AAA
I am in BBB
I am in CCC

Console Classes

by Emmaneale Mendu
In this post i will show you how to work on two classes.

Lets start adding two classes as shown below and imagine User entered AccountNumber and we need to show him UserName and Account Balance.

class AccountNumber
    {
        static void Main()
        {
            UserName();

            Console.ReadKey();
        }
    }

    class Details
    {
        public static void UserName()
        {            
            Console.WriteLine("Emmaneale Mendu");
        }
    }


Compilation Error
'UserName' does not exist in the current context.


So, oops! error. while working in the same class, we can the method directly but while working with different classes like above one. Here we have a new class Details. we are trying to call a method which is in the Details class from AccountNumber class, so we  need do have use Details class name to acces it as shown in the below program.

class AccountNumber
    {
        static void Main()
        {
            Details.UserName();

            Console.ReadKey();
        }
    }

    class Details
    {
        public static void UserName()
        {            
            Console.WriteLine("Emmaneale Mendu");
        }
    }

OutPut
Emmaneale Mendu

Thank GOD, no errors this time.

my intension is getting Account Balance also, Lets do it with using some secure manner. follow the code below.

class AccountNumber
    {
        static void Main()
        {
            Details.UserName();

            Details.Balance();

            Console.ReadKey();
        }
    }

    class Details
    {
        public static void UserName()
        {            
            Console.WriteLine("Emmaneale Mendu");
        }

        //Default this method is private
        static void Balance()
        {
            Console.WriteLine("1,000,000,000");
        }
    }

Compilation Error
Details.Balance() is inaccessible due to its protection level.

By reading the error we can know that Balance method is secured in that class itself. By this we can know whats going on with private and public keywords.

class AccountNumber
    {
        static void Main()
        {
            Details.UserName();

            Details f;

            //Details.Balance();
            Console.ReadKey();
        }
    }

    class Details
    {
        public static void UserName()
        {            
            Console.WriteLine("Emmaneale Mendu");

            //you can call method from inside a class
            Balance();
        }

        //Default this method is private
        static void Balance()
        {
            Console.WriteLine("1,000,000,000");
        }
    }

OutPut
Emmaneale Mendu
1,000,000,000

So, hence we are calling Balance method from inside the class using same flow.

Console Formatting

by Emmaneale Mendu

Hi guys in this post we will learn about printing or formatting capabilities of the WriteLine function.
class Program
    {
        static void Main(string[] args)
        {
            Hello();

            Console.ReadKey();
        }

        ///
        /// Welcome Message
        ///
        static void Hello()
        {    
            Console.WriteLine("Hello {0}!", "World");
        }    
    }

OutPutHello World!

The zero in the curly braces means that first comma there is some value and that it should display this value. In the same way if you have two or more it can work as shown below.

class Program
    {
        static void Main(string[] args)
        {
            Hello();

            Console.ReadKey();
        }

        ///
        /// Welcome Message
        ///
        static void Hello()
        {    
            Console.WriteLine("Numbers {0},{1},{2},{3}!",100,200,300,400);
        }    
    }

OutPut
Numbers 100,200,300,400!

Here the {0} is replaced with 100 and {1} is replaced with 200 and so on.....

Play with Boolean now.

class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("{0}", 5 > 2);
            Console.WriteLine("{0}", 5 < 2);
            Console.WriteLine("{0}", 2 < 2);
            Console.WriteLine("{0}", 2 <= 2);

            Console.ReadKey();
        }
    }

OutPut
True
False
False
True

Monday, September 13, 2010

Console Functions

Lets understand how functions are called and created in Console Application.

class Program
    {
        static void Main(string[] args)
        {
            Hello();
        }
    }

Compile Error::

The name 'Hello' does not exist in the current context

So, make sure that before calling a function create it first. Then call the function as shown bellow.


class Program
    {
        static void Main(string[] args)
        {
            //Calling Welcome function
            Hello();

            Console.ReadKey();
        }

        ///
        /// Welcome Message
        ///
        static void Hello()
        {
            Console.WriteLine("Hello World");
        }
    }

Output

Hello World

Lets go other way calling multi-functions from Main() method as shown below.


class Program
    {
        static void Main(string[] args)
        {
            //Calling Welcome function
            Hello();
            VisitAgain();
            Hello();

            Console.ReadKey();
        }

        ///
        /// Welcome Message
        ///
        static void Hello()
        {
            Console.WriteLine("Hello World");
        }

        ///
        /// Good Bye Message
        ///
        static void VisitAgain()
        {
            Console.WriteLine("Good Bye, Visit again");
        }
    }

OutPut

Hello World
Good Bye, Visit againHello World

Lets work differently like calling VisitAgain() function from Hello() function not from Main() as shown below.

class Program
    {
        static void Main(string[] args)
        {
            //Calling Welcome function
            Hello();      

            Console.ReadKey();
        }

        ///
        /// Welcome Message
        ///
        static void Hello()
        {
            Console.WriteLine("Hello World");
            VisitAgain();        
        }

        ///
        /// Good Bye Message
        ///
        static void VisitAgain()
        {
            Console.WriteLine("Good Bye, Visit again");
        }
    }

OutPut

Hello World
Good Bye, Visit again

Getting started with Console Application

How to start with Console application


  • Click file menu select New project.
  • In New project window select Visual C# in Project types section and Console Application in Templates Section.
  • Change Name field (Desired Name).
  • Click OK
Then you see a default Code as shown below
//Pre-defined Namespaces for our program explained later in the next postusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//We can have group of Namespaces in one .cs file
namespace ConsoleApplication2 
{
    class Program
    {
      //Main function.. the word indicates "Main". Execution of .cs file starts with Main() function/Method
        static void Main(string[] args)
        {
        }
    }
}
Lets start with first application in console application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            //Display some text or write some values like Output values we use Write/Writeline
            Console.WriteLine("Welcome to CoolTuts");
            //After execution out Output window. we can call black screen or output window. It stops at this point
            Console.ReadKey();
        }
    }
}
OUTPUT
Welcome to CoolTuts

C# Topics

Unreachable Code detected

class Program
{
static void Main()
{
if (false)
Console.WriteLine("HI");//Warning.. Never executes this line
Console.ReadKey();
}
}

Compiler Warning
a.cs(6,1): warning CS0162: Unreachable code detected

Example in Console Application

class
{
static void Main()
{
System.Console.WriteLine ("{0}", 5 > 2);
System.Console.WriteLine ("{0}", 6 < 2); System.Console.WriteLine ("{0}", 1 < 1); System.Console.WriteLine ("{0}", 1 <= 1); System.Console.WriteLine ("{0}", 3 != 3); System.Console.WriteLine ("{0}", 1 !=2); } } OutputTrue False False True False True Here the first line says WriteLine("{0}", 5 > 2); Is 5 > 2 ? Yes. So the condition 5 > 2 evaluates to true. Hence the {0} in WriteLine is replaced with True and the WriteLine function displays True. 5 > 2 is called a condition. A condition is like a question which has to result in a yes or no or a true or false. In this case the number 5 is greater than the number 2 and hence the function evaluates to true. C# understands the words true and false.

Friday, August 27, 2010

Getting Started with Visual Studio

About visual studio .Net integrated development environment:
When we are installing 3.5 .Net framework Automatically getting visual studio 2008 version environment, Using this IDE we can implement all .Net tech, the microsoft given by default only three language features.

1) Visual c#
2) Visual Basic
3) Visual C++

Open visual Studio .Net

Click on Start menu --> programs --> microsoft visual studio 2008 -->Click

environment with start page

Start page having six recently opened projects.

Opening with form Application


Click on the file menu, select new --> click on new project

Getting new project window with two sub windows
i) project types window
ii) templates window

Project types window
It is having collection of .net languages select visual C# in the project types window

Templates window
This window having collection of selected language concepts, select win-forms application from the templates window.

Click OK, getting C#.Net windows application

In the windows form application getting pre-defined container called form, form container having collection of graphical user interface. As per .net framework all containers are classes.

In the form container we can add collection of controls, As per .net framework all controls are objects.

C#.Net Features

Supports OOP Rules .Net technologies are implemented based on object oriented programing rules, In C#.Net rules we can implement data encapsulation, data abstraction, inheritance and polymorphism.

Console Application:
These are used to implement character user interface features, console application output getting in the dos prompt by default.

Windows Application:
Using windows application we can implement graphical user interface features, In the windows application getting pre-define container called form, form-container having collection of controlls.

Graphical designing interface(GDI)
Windows application by default depending on the graphical user interface features, using GUI features we can add the control, we can use the menu's, status box and etc., Using GDI without using any control we can give 2D graphics and 3D graphics in the Form Container.

Type Security
C#.Net language supports type security, In the C#.Net we have to convert all data type values manually, because of the type security in the C#.Net each and every statement is secured.

Structured exception handling
When the application having run-time errors the normal application execution terminates abnormally, to overcome this problem we have to work with exception handling.

Thursday, August 26, 2010

Manage code and Unmanaged code

Managed Code:
It is getting from the .Net technologies, managed code we can classify into two types.
(i) Safe Code  (ii) Unsafe Code

Safe Code:
Getting from .Net technology, Unsafe code supports only functions.

Unsafe Code:
Getting from .Net technology, Unsafe code implemented using pointers.

Unmanaged code:
Getting from different languages, which language giving dynamic link libraries that language features we can access in the .Net framework, It doesnt communicates with the CLR.

Saturday, August 21, 2010

A program consists of two files(class file, csc file)

//csc Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
           Hello Name = new Hello();  //instance Hello class object
           Console.WriteLine("Enter ID 1 or 2");
           Int16 ID = Convert.ToInt16(Console.ReadLine()); //Read the input
           String MyName = Name.FullName(ID); //calling Hello methos
           Console.Write(MyName.ToString()); //Display output
           Console.ReadKey(); //Hold the console application window
          }
      }
}

//Class Hello.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
      class Hello
      {
         public String FullName(Int16 ID)
          {
            if (ID == 1)
               return "Emmaneale";
            else
               return "Mendu";
           }
       }
}

How to display "Hello World" in Console Application

File Hello.cs

Using System; //uses the namespace system

class Hello //file name and class name need not be identical
{
       static void main() //entry point must be called Main
       {
           Console.WriteLine("Hello World"); //Output goes to Console
       }
}

Compile in the Console window(Command prompt)

Output( after Execution)
Hello World

Tuesday, August 3, 2010

C# Architecture

C-language Arch(Dependent):

C-language supports one type of source code, one compiler and one type of binary format data, c-language source code can communicates with the c-compiler, compiler gives object format file, this file having c-language source code in the binary format and information about the operating system, object file can communicates with the one o/s directly. C-language is platform dependent.

Java-language Arch(Independent):

The java language supports one type of source code, one compiler and one type of binary format data, java-language supports java-c compiler this compiler communicates with the java language source code gives class format data. class file having only binary format data doesn't having information about o/s, for executing class file in the various types of operating systems. we have to use java virtual machine(jvm) communicator java lang. is a platform independent.

.Net Arch(Independent):

CSC:
csc is the sub-compiler in the .Net framework, this compiler communicates with the c#.net source code, csc compiler gives intermediate language format file.

Intermediate language format:
IL format having specific language types into the binary format, all IL formats communicates with the common language runtime compiler.

Common Type System(CTS):
Using cts we can convert different language data types into the common type, different data types having in the sub-compilers, common data types having in the CLR.

Common language Specification:
Using CLS we can convert different languages source code into the common source code, different languages source code having in the sub-compilers. common source code having in the CLR.

MSIL:
The MSIL format getting after communicating all sub-compilers with the CLR, MSIL having common type of data typesand source code, MSIL format can communicates with the various operating systems.

Just intime compiler:
JIT compiler is communicator between MSIL format and specific o/s, because of the JIT compilers the .Net technologies are platform independent.

Saturday, July 31, 2010

C# Framework

.Net Framwork:
                       
                     The microsoft introduced .Net framework in the 2000 year, the microsoft implemented collection of compilers in the .Net framework, .Net framework supports collection of namespaces.

Namespaces:

                     .Net framework is the collection of namespaces, every namespace is dynamic link library(DLL), namespaces having collection of object oriented programming features, namespace features we can distribute in the all .Net technologies.

Common Languages Runtime(CLR):

                     In .Net framework main compiler is CLR, CLR having common datatypes and common source code, In the CLR microsoft implemented 23 sub-compilers, each sub-compilers having different types of data types and source code. All sub-compilers communicates with the CLR for converting into the common type of data types and source code.