An application is said to be multilingual if it can be deployed in many different languages. With .NET, all of the languages including Visual Basic, .NET, C#, and J# compile to a common Intermediate language (IL). This makes all languages interoperable. Microsoft has created Java bytecode, which is a low-level language with a simple syntax, which can be very quickly translated into native machine code.
CLR
.NET Framework is a multilingual application because of CLR.
CLR is the key to .NET Framework. The code running under the control of the CLR is often termed as managed code.
The main task of CLR is to convert compiled code into the native code.
.NET Framework has one or more compilers; for e.g., VB .NET, C#, C++, JScript, or any third party compiler such as COBOL.
Anyone of these compilers will convert your source code into Microsoft Intermediate Language (MSIL). The main reason for .NET to be multilingual is that you can compile your code from IL and this compiled code will be interoperable with the code that has been compiled to IL from another language.
It simply means that you can create pages in different languages (like C#, VB .NET, J#, etc.), and once all of these pages are compiled they all can be used in a single application. Let us understand this point clearly with an example.
Let us consider a situation where a customer needs an application to be ready in 20 days. For completing the application in 20 days we want 30 developers who all know the specific language but we have 15 developers who know C# and 15 developers who know VB .NET. In this situation, if we don’t use .NET then we need to hire 15 more developers of C# or VB .NET which is a difficult and costly solution. Now, if we use .NET then we can use C# and VB .NET language in the same application. This is possible because once C# code is compiled from IL it becomes interoperable with VB .NET code which is compiled from IL.
Then JIT (Just In Time) of CLR converts this MSIL code into native code using metadata which is then executed by OS.
CLR stands for common language runtime. Common language runtime provides other services like memory management, thread management, remoting, and other security such as CTS and CLS.
CLR is a layer between an operating system and .NET language, which uses CTS and CLS to create code.
CTS
CTS stands for the common type system. CTS defines rules that common language runtime follows when we are declaring, using, and managing type. CTS deals with the data type.
.NET supports many languages and every language has its own data type. One language cannot understand data types of another language.
For example: When we are creating an application in C#, we have int and when we are creating an application in VB .NET, we have an integer. Here CTS comes into play -- after the compilation, CTS converts int and integer into the int32 structure.
CLS
CLS stands for common language specification.
CLS is a subset of CTS and it declares all the rules and restrictions that all languages under .NET Framework must follow.
The language which follows these rules is known as CLS compliant.
For example, we can use multiple inheritances in c++ but when we use the same code in C# it creates a problem because C# does not support multiple inheritances. Therefore, CLS restricts multiple inheritances for all languages.
One other rule is that you cannot have a member with the same name and a different case.
In C# add() and Add() are different because it is case-sensitive but a problem arises when we use this code in VB .NET because it is not case-sensitive and it considers add() and Add() as the same.