Wednesday, 21 October 2015

Diffrence between Value type and Refrence Type

Value type:  Value type stored value. value type stored in Stack.

   Example:  Enum,Structs

Refrence type:  it's stored refrence to actual data are called Refrence type.

Example: String,Object,Array,Class,Interface


Value Type Refrence Type
1. It's stored in Stack 1. It's stored in Heap
2. Value type contains actual value 2. Refrenc Contains Refrence of value
3. Memory allocation will be on compile time 3. Memory allocation will be on run time
4. Example: Enum,Struct,int,bool,float 4. Example:Class,Delegete,string,Object,Array
5. System.ValueType 5. System.Object

No comments:

Post a Comment