In this blog, I’m explaining about CTS in .Net
CTS defines a collection of data types, which are used and managed by the run time to facilitate cross-language integration.
CTS provides the types in the .NET Framework with which .NET applications, components and controls are built in different programming languages so information is shared easily. In contrast to low-level languages like C and C++ where classes/structs have to be used for defining types often used (like date or time), CTS provides a rich hierarchy of such types without the need for any inclusion of header files or libraries in the code.
1. It enables cross-language integration, type safety, and high-performance code execution.
2. It provides an object-oriented model for implementation of many programming languages.
CTS supports two different kinds of types:
Value Types: Contain the values that need to be stored directly on the stack or allocated inline in a structure. They can be built-in (standard primitive types), user-defined (defined in source code) or enumerations (sets of enumerated values that are represented by labels but stored as a numeric type).Reference Types: Store a reference to the value‘s memory address and are allocated on the heap. Reference types can be any of the pointer types, interface types or self-describing types (arrays and class types such as user-defined classes, boxed value types and delegates).
All the structures and classes available in CTS are common for all .NET Languages and purpose of these is to support language independence in .NET. Hence it is called CTS.
For exampleCTS defines System.Int32 – 4 byte integer
C# defines int as an alias of System.Int32
string -> System.String
object -> System.Object