1. Value type
The data types which are capable of storing the data directly into their memory locations are known as “value type”.
Ex: int a=10; a=>10.
The data types which can’t store the data directly rather refer to other memory locations where data will be stored are known as “reference types”.
What is Difference b/w value type and Reference type?
Store the data directly into their memory location
Memory is allocated at compile time
Memory allocated is made in stack i.e. continuously memory location
CLR doesn’t provide automatic memory management
Occupies less memory
If the data is initialized, then stores the default values into the variable
ex: int a; a=>0
Do not store the data type directly into their memory location. rather than refers to other memory location where data is stored
Memory is allocated at runtime
Memory allocations are made within the heap i.e. random memory allocations.
CLR provides automatic memory management
Occupies heap memory. A single reference type variable can occupy a maximum of up to 2GB of memory
If the data is not initialization then stores the null reference the variable
ex: string s; s=> null