Ans - . NET is a software platform. It's a language-neutral environment for developing .NET applications that can easily and securely operate within it.
The .NET Framework has two main components: the Common Language Runtime (CLR) and the .NET Framework class library.
The .net framework allows objects, classes and functions created in multiple programming languages the ability to communicate effectively amongst themselves. During code compilation whithin the .Net framework, source code is converted into MSIL(Microsoft Intermediate Language). MSIL, or IL, is the common language created that the CLR(Common Language Runtime) can read and understand. Once .Net code is compiled into intermediate language(MSIL, IL) objects written in VB.Net may reference or inherit functionality from objects written in Visual C#.Net, managed C# or any other .Net language.
For each source code compiler (VB.Net, C#.Net, etc), there is a minimum set of coding standards that must be met. The minimum set of coding standards that must be met to compile .Net code into MSIL code is known as CLS-Common Language Specification. The role of the CLS is to ensure that all generated code (MSIL) that meets the minimum set of coding standards can operate successfully whithin the .Net framework.
The CTS (Common Type System) handles conversion of programming language data types into .Net compatible(MSIL) data types. The implicit benefit of the CTS is the reduction of development time when attempting to coordinate data types between two sets of different programming language code. The languages that are currently available in the VS.Net framework include: VB, VC#, VC++ & JScript Scripting Language.
The class library is a comprehensive collection of reusable types that you can use to develop traditional command-line, WinForm (graphical user interface) applications, Web Forms and XML Web services.
Q2. What is a CLR?
Ans - Full form of CLR is Common Language Runtime and it forms the heart of the .NET framework. All Languages have runtime and its the responsibility of the runtime to take care of the code execution of the program. For example VB6 has MSVBVM60.DLL, Java has Java Virtual Machine etc. Similarly .NET has CLR. Following are the responsibilities of CLR
- Garbage Collection :- CLR automatically manages memory thus eliminating memory leaks. When objects are not referred GC automatically releases those memories thus providing efficient memory management.
- Code Access Security :- CAS grants rights to program depending on the security configuration of the machine. Example the program has rights to edit or create a new file but the security configuration of machine does not allow the program to delete a file. CAS will take care that the code runs under the environment of machines security configuration.
- Code Verification :- This ensures proper code execution and type safety while the code runs. It prevents the source code to perform illegal operation such as accessing invalid memory locations etc.
- IL( Intermediate language )-to-native translators and optimizer’s :- CLR uses JIT and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code.
Q3. What is a CTS?
Ans - As described above in the Q1, In order that two language communicate smoothly CLR has CTS (Common Type System). Example in VB you have "Integer" and in C++ you have "long" these datatypes are not compatible so the interfacing between them is very complicated. In order to able that two different languages can communicate Microsoft introduced Common Type System. So "Integer" datatype in VB6 and "int" datatype in C++ will convert it to System.int32 which is datatype of CTS. CLS which is covered in the coming question is subset of CTS.
Q4. What is CLS(Common Language Specification)
Ans - This is a subset of the CTS which all .NET languages are expected to support. CLS is nothing but guidelines that languages have to follow so that it can communicate with other .NET languages in a seamless manner.