Hello Friends,
In
this Chapter we will discuss about Data Type in C# dot net and Difference
between Value Type and Reference Type.
Data Type:
In Dot net platform our Data types are divided into two types one is value type and anather is Reference type.please follow the following steps about its
classifications.

Difference between Value Type and Reference Type:
Value Type
|
Reference Type
|
||
1
|
Basically Value type store
real data
|
1
|
But Reference type store reference to the data.
|
2
|
Value type data stores in stack memory.
Ex:int i=20;
The value 20 stores in stack memory location.
|
2
|
Reference type data stores in
heap memory.
Ex:int [] arr ayyay=new int[55];
This value will require memory for 20 integer and stores in heap area.
|
3
|
Value type is faster for access.
|
3
|
Reference is slower for
access.
|
4
|
It can’t contain null value
|
4
|
It can contain null value
|
5
|
When data store than memory allocate at compile time.
|
5
|
When data store than memory allocate at run time.
|
6
|
Structure,enumeration are
value type.
|
6
|
Class,array,interface,deligate etc are reference type
|
I have explained about
Data Type in C# dot net and Difference
between Value Type and Reference Type..So after read please Comments and
suggestions.
Thanks & Regard
Rabi
No comments:
Post a Comment