Data types in C # - an overview
This practical tip gives you an overview of the data types used in C #.
The class "Object" - root of the type system of C #
The "Object" class is the top basic class of the C # type system. All types can be derived from this class. Since "Object" is a class, it can be inherited by other classes. This inheritance does not have to be written explicitly, but is set implicitly if another inheritance relationship is not specified.
Type differentiation in C #
After you have got an overview of the class "Object" in the first section, we now turn to the value and reference types. These two types of types are located directly under "Object". Technically, they differ in that a value type receives its data immediately and the reference type only receives a reference to a memory area.
value types
Value types are divided into two different type groups: structures and enumerations. All structures are derived from the "ValueType" class. The structures are divided into:
- Integers (byte, int)
- Floating point numbers (single, double, decimal)
- Other structures (char, boolean)
Reference types in C #
Reference types are characterized by the fact that no values are stored directly in them, but only have a reference to the actual value. The reference types include:
- arrays
- Character strings
outlook
In this practical tip, we only take up the topic of value and reference types roughly. Further detailed information can be found in the Microsoft .NET framework documentation.
Another practical tip will give you tips on how to create your first C # program.