LogoASPAlliance: Articles, reviews, and samples for .NET Developers
Understanding Common Type System in .NET
by Suresh Kumar Goudampally
Average Rating: 
Views (Total / Last 10 Days): 32776/ 102


The Common Type System (CTS) defines how types are declared, used, and managed in the runtime, and is also an important part of the runtime's support for cross-language integration.

CTS Provides the data types, values, object types. This helps developers to develop applications in different languages, where .NET languages share CTS means all the types used in applications share the same types defined under CLI.


1.    Establishes a framework that enables cross-language integration, type safety, and high performance code execution.

2.    Provides an object-oriented model that supports the complete implementation of many programming languages.

3.    Defines rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.

Diagram representing Common Type System and categories

Figure 1


Value Types and Reference Types

Value Type

A variable of this type represents a piece of data itself. Memory is allocated on the stack.

Listing 1

// Structure , Enumerations and primitive datatypes.
int i = 8;
int i1 = i;
i = 9;

Here, changing one will not have impact on another; the memory here is created twice.

Reference Type

A variable of this category points to the location of data rather than data itself. Memory is created on the heap. Arrays, Classes, Delegates and Interface are examples.

This type is similar to pointers.

Listing 2

Class1 objClass1 = new Class2();
objClass1.Name = "S";
Class1 objClass1Intance = objClass1;
objClass1Intance = "SU";      

Here, both instances refer to the same object, changes to one applies to both.

Common Language Specification

Common Language Specification (CLS) defines a subset of Common Type System, which all language compilers targeting CLR must adhere to. CLS is a subset of CTS.  

All compilers under .NET will generate Intermediate Language no matter what language is used to develop an application. In fact, CLR will not be aware of the language used to develop an application. All language compilers will generate a uniform, common language called Intermediate Language. For this reason IL can be called as the language of CLR A platform for cross language development.

Common Points of Common Type System

1. CTS provides base set of datatypes which is responsible for cross language integration.

2. Most languages use aliases to implement those types (Eg: C# implements int as alias for Int32).

3. CTS is categorized into two types called ValueTypes and ReferenceTypes.

4. Each object in the hierarchy has the common interface.

5. Ensures Type - Safe Code.

Type - Safe Code means given a valid object reference, type-safe code can access memory at fixed offsets corresponding to actual field members.

6. Defines rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.

7. Set of Base Types is called CTS.

8. Multiple Inheritance is not allowed in .NET and this can be treated as one of the rules.

9. System.Object is a common base type where all other types are derived from.

10. CTS standardizes the conventions that all the languages must follow.

11. CTS is responsible for defining types that can be used across the .NET Languages.

12. Variables that are Value Type have their own copy of the data.

13. Value Types and Reference Types, all are derived from type called System.Object.

14. Common Language Specification is the subset of Common Type System. (Defines Language rules to be followed.)

15. CTS provides types that are available to be used by programs in .NET and CLS specifies how those type are to be used in a consistent manner to ensure compatibility with other languages.


In this article, you have learned the concept of Common Type System and its purpose. We also examined value and reference types and some of the common points relevant to Common Type System.

©Copyright 1998-2021  |  Page Processed at 2021-12-07 7:27:49 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search