Common Type System in C#
Written by Abhishek Ghosh
The unified type system followed by C# is known as the Common Type System or CTS.
A unified type system implies that all types, including primitives such as integers, are subclasses of the System.Object class. For example, every type inherits a ToString() method. For performance reasons, primitive types (and value types in general) are internally allocated on the stack.
Categories of datatypes
CTS separates datatypes into two categories:
1. Value types
2. Reference types
Value Types :
Value types are plain aggregations of data. Instances of value types do not have referential identity nor a referential comparison semantics - equality and inequality comparisons for value types compare the actual data values within the instances, unless the corresponding operators are overloaded. Value types are derived from System.ValueType, always have a default value, and can always be created and copied. Some other limitations on value types are that they cannot derive from each other (but can implement interfaces) and cannot have a default (parameterless) constructor. Examples of value types are some primitive types, such as int (a signed 32-bit integer), float (a 32-bit IEEE floating-point number), char (a 16-bit Unicode codepoint), and System.DateTime (identifies a specific point in time with millisecond precision).
Reference Types :
In contrast, reference types have the notion of referential identity - each instance of reference type is inherently distinct from every other instance, even if the data within both instances is the same. This is reflected in default equality and inequality comparisons for reference types, which test for referential rather than structural equality, unless the corresponding operators are overloaded (such as the case for System.String). In general, it is not always possible to create an instance of a reference type, nor to copy an existing instance, or perform a value comparison on two existing instances, though specific reference types can provide such services by exposing a public constructor or implementing a corresponding interface (such as ICloneable or IComparable). Examples of reference types are object (the ultimate base class for all other C# classes), System.String (a string of Unicode characters), and System.Array (a base class for all C# arrays).
Both type categories are extensible with user-defined types.

Articles














Comments
I am from Kyrgyzstan and also now am reading in English, give please true I wrote the following sentence: "Wiesel rejected the 1981 nobel prize in physiology or medicine."
With love ;), Zoe 8 diameter rain shower heads.
I am from Zaire and also now am reading in English, give true I wrote the following sentence: "Particularly we help a influencing reason powder to contacting the name introduction."
Thanks for the help :-), Enrique.