Value Types and Reference Types Explained
There are two types of data types in the .NET framework: Value and reference types. Lets first have a look at the value types : Value types are allocated on the current thread’s stack. The lifetime of the value type is only inside the scope where it is used. When you pass a value type as a parameter in a method, the value type is copied. A wrapper object is created if you pass a value type to a method that expects an object. Value types are suitable for representing lightweight objects such as vectors, matrices and colors. Value types has less overhead than classes by the fact that no additional memory for the reference is needed. However, there are a few things that are worth mentioning: Structs can’t have a default parameterless constructor. It is provided by default and it initializes all the fields to their default values. You can’t initialize an instance field inside a struct You can’t use inheritance in structs Value types are important for