What Does Common Type System Mean?
The Common Type System (CTS) is a standard for defining and using data types in the .NETframework. 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.
CTS is a specification created by Microsoft and included in the European Computer Manufacturer‘s Association standard. It also forms the standard for implementing the .NET framework.
Techopedia Explains Common Type System
CTS is designed as a singly rooted object hierarchy with System.Object as the base type from which all other types are derived. 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).
Although operations on variables of a value type do not affect any other variable, operations on variables of a reference type can affect the same object referred to by another variable. When references are made within the scope of an assembly, two types with the same name but in different assemblies are defined as two distinct types, whereas when using namespaces, the run time recognizes the full name of each type (such as System.Object, System.String, etc.). The rich set of types in CTS has well-designed semantics such that they can be widely used as a base type in Common Language Runtime (CLR) -based languages. This is why all .NET developers must have a thorough understanding of CTS.