Monday 13 April 2015

What is value types and reference types in c# with example?


What is data types:
Data types specify the size and type of values that can be stored. The types in c# are divided into two categories:
1-    Value types
2-    Reference types
What is value types:-
Value types are fixed length. It stored on the stack. It is divided two types.
1-    User defined types
Example:
Struct and enumerations
2-    Predefined types:-
Example:
Numeric types (integer, floating point, decimal)
Boolean types
Character types
Reference types:-
Reference  types are variable length are stored on heap.
It also divided two types like
1-    Predefined types
Example:-
Object type and string type
2-    User defined types
Example:
Classes, delegates, interfaces, arrays

No comments:

Post a Comment