If I talk about .NET then what is CTS aka Common Type System?IntroductionEvery language (in .Net Framework) has its own data types that are represented by a class or structure and collection of all the classes and structures related to data types called Common Type System (CTS). Every language provides its own keywords for data types but internally all the languages that run under .NET framework use the classes and structures available in the CTS. For example, C# has the int data type and VB.Net has the Integer data type. Hence a variable declared as int in C# or Integer in vb.net, and finally after compilation, use the same structure "int32" from the CTS. MotiveAll the structures and classes available in the CTS are common for all .NET Languages and purpose of these is to support language independence in .NET, so this motive is resolved by the CTS.Explanation with a real example: To explain the CTS I will create 2 console applications in 2 different languages like:
VB.Net
Step 1: Create first a Console application in VB.Net named "ConsoleApp_VB".Step 2: Create a variable of Integer type and assign a value, like 10, and build the application, that generates the .exe file in the bin folder of the project.Dim i As Integer = 10
Step 3: Open "IL Disassembler" by selecting the Start menu then "Microsoft Visual Studio 2010" -> "Microsoft Windows SDK Tools".Note: I am using Visual Studio 2010.Step 4: Open your .exe file that exists in the bin folder of the project via "File" -> "Open".Step 5: The .exe file loads in "IL Disassembler" after the selection, that will look like :Step 6: Now double-click on the "Main" method that shows the following window where you can see your variable "i" that was Integer type and now it converts into "int32".C#Now I will do the same process from Step 1 to Step 6 for C#.Step 1: Create the first Console application in C# named "ConsoleApp_CS".Step 2: Create a variable of int type and assign a value like 10 and build the application that generates the .exe file in the bin folder of the project.int i = 10;Step 3: Again open the "IL Disassembler" by selecting the Start menu then "Microsoft Visual Studio 2010" -> "Microsoft Windows SDK Tools".Note: I am using Visual Studio 2010.Step 4: Open your .exe file that exists in the bin folder of the project via "File" -> "Open".Step 5: The .exe file loads in "IL Disassembler" after the selection, that will look like:Step 6: Now double-click on the "Main" method that shows the following window where you can see your variable "i" that was an int type and now it converts into "int32". ConclusionI hope now you have an understanding of the Common Type System that converts both the Integer of VB.Net and int of C# into int32.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: