Sep 20, 2011

Data types in C#

C sharp is strongly typed language. It is means it is necessary to declare a type of every variables or objects in c sharp program.




In broader sense we can categorized the all data types in two groups:
1. Value type
2. Reference type

Value types in c#:
All the variables of data types which come under the value types keep the value directly. In other word content of variable is constant value which has been assigned to it. For example:
int a = 5;
int b = a;

Content of variable a is 5 and content of variable b is also a constant that is 5.

References types in C#:
All the variables of data types which come under the reference types keep the reference to the actual data. In other word content of variable instead of actual data it keeps reference to the actual data.
We can convert the value types into reference types and reference types into value types using concept of boxing and unboxing. 
  

2 comments:

  1. Thanks its very nice article and good informative tutorial.dapfor provide tutorial which very easy and informative u can visit here dapfor. com

    ReplyDelete