What is CLS?
CLS, which is a component of the Common Language Runtime (CLR) in .NET, provides support for multiple programming languages like C#, VB.net, and VC++.net.
Each programming language comes with its own set of syntactical rules, known as the language specification. These rules are specific to each language and may not be directly understandable by other languages.
Although one programming language cannot comprehend the language specification of another, the CLR has the unique capability to execute code written in different languages. This is possible because the CLR doesn't understand any language specification directly; instead, it has its own language specification (syntactical rules) for its Intermediate Language (MSIL/IL).
When code is written and compiled, each language-specific compiler compiles the code according to the CLR's specification and converts it into MSIL. The Just-In-Time (JIT) compiler of the CLR then converts the MSIL into native code, which is a common language specification (CLS) for all programming languages executed within the CLR.
For instance, let's take C# and VB.NET as examples: In C#, each line of code ends with a semicolon (;), known as a statement terminator. However, in VB.NET, not every line of code requires a semicolon.
These varying syntax rules across different languages are handled by the CLR's JIT compiler, which reads the MSIL code generated by each language-specific compiler according to the CLR's language specification.