Data types specify the size and the type of values that can be stored.
So,in C# there are two categories of data types:
(a) Value types
(b) Reference types
(a) Value types:
These are stored on the Stack, and when value of a variable is assigned to another,they are actually copied.Hence two identical copies of that variable exits in memory.
hence it refers that two variables with same values in the memory.Value data types are: integers,real numbers, Boolean,characters,Enumerations,structures.
(b)Reference types:
These are stored on heap, so when assignment of two reference variable occurs, only the reference is copied but actual value remains in d same memory location.Which implies that,there are two references to a single value.
reference data types are:objects,strings,classes,arrays,delegates,interfaces.
No comments:
Post a Comment