Understanding the predefined .NET data types
There are two types of predefined data types:
- Reference types
- Value types
The reference types are objects and strings. The value types consist of enumeration and struct types. Struct types are aggregated of simple types. Simple types consist of Boolean, char, and numeric types.
There are three main numeric types: decimal types, floating-point types, and integer types. Floating-point types consist of decimals, doubles, and floats. The integer types consist of bytes shorts, integers, longs, value tuples, and characters.
We are going to mention the stack and the heap in more detail later in the chapter. But for now, we should understand that the stack is unmanaged memory, and the heap is managed memory.
Value types live on the stack. Value types in arrays live on the heap. And reference types live on the heap, with their pointers living on the stack.
Note
Even if arrays are not ideal for some scenarios,...