There's more...

When you learned about the basic data types that we frequently use, you will have noticed that most of them were so-called value types. In .NET, we differentiate between value types and reference types. Value types are created in the stack, whereas reference types are a reference to the heap.

Value types such as integers or Boolean values do not possess any properties other than their own value. Their structures usually provide a variety of conversion methods, such as the ubiquitous ToString method on every object, or the ToDateTime method on an integer.

Reference types like System.Diagnostics.Process are stored on the heap and undergo garbage collection by the language runtime. Be careful when working with reference types. Since only a reference to an object on the heap is stored in a variable, copying the variable will only copy the reference, and not the value itself.

Try the following bit of code to visualize the difference between value and reference types:

# Value types and reference types
# Vale types like integers are stored in the stack
$intA = 4
$intB = $intA
$intB = 42
$intA -eq 4 # still true

# Reference types like arrays are pointing to the heap
$arrayA = 1,2,3,4
$arrayB = $arrayA
$arrayB[0] = 'Value'
$arrayA[0] -eq 1 # This is now false! arrayA has been changed as well as arrayB