There are two types of data type on C#: Value types and Reference types
Value Type:
A value type holds a data value within its own memory space. It means variables of these data types directly contain their values. They are derived from the class System.ValueType.
Example of value types: bool, byte, char, decimal, double, enum, float, int, long, sbyte, short, strut, uint, ulong, ushort.
When you declare an int type, the system allocates memory to store the value.
In terms of memory allocation, Value types are stored in the Stack.
Reference type
A reference type doesn’t store the actual data directly. Instead, it stores the address where the value is being stored. In other words, a reference type contains a pointer to another memory location that holds the data. If the data in the memory location is changed by one of the variables, the other variable automatically reflects this change in value.
Example of built-in reference types: object, string and dynamic.
In terms of memory allocation, Reference type are stored in the Heap.
[amazon_link asins=’007070368X,1787287041,1788478924,9351190900,8120349172,9351343189,1484213335,B016Z18MLG,8120352068′ template=’ProductCarousel’ store=’desibanjara22-21′ marketplace=’IN’ link_id=’5e6fb197-8f3f-11e8-81bb-8bbb244f188c’]