| 1. |
What are Common Type System(CTS) and Common Language Specification(CLS)? |
|
Answer» Common TYPE System (CTS): The data types that managed code can use are described by the Common Type System (CTS). In the runtime, CTS describes how these types are declared, utilised, and managed. Cross-language integration, type safety, and high-performance code execution are all made easier using it. You can utilise the CTS rules to create your own classes and values. ALTERNATIVELY, we can comprehend SOMETHING like this that the data type is dealt with by CTS. So we have a number of languages, each of which has its own data type. While one language's data type may be incomprehensible to other languages, the .NET Framework language can comprehend all data types. Integer data types are available in both C# and VB.NET. As a result, a variable specified as an int in C# and Integer in VB.NET utilises the same structure Int32 from CTS after compilation as shown in the figure below. All of the structures and classes in CTS are shared by all.NET languages, and their PURPOSE is to support language NET's independence. As a result, it is known as CTS. Common Language Specification(CLS): CLS is a subset of CTS and stands for Common Language Specification. It specifies a set of rules and constraints that must be followed by any language that runs on the .NET framework. CLS Compliant languages are those that follow this set of rules. CLS facilitates cross-language integration, or interoperability, in basic terms. As an example, if we are talking about C# and VB.NET, every statement in C# must end with a semicolon. Although it is often known as a statement Terminator, that is, each statement in VB.NET should not conclude with a semicolon (;). An explanation of the mentioned example is that while the syntax rules change from language to language, CLR can understand all of them because, in .NET, each language is transformed into MSIL (Microsoft Intermediate Language) code after compilation, and MSIL code is CLR's language specification. |
|