What is the Difference between value and reference type?

Answer Posted / ajay

whenever a datatype is defined based on a structure it is said to be value type datatype.
whenever a datatype is derived from class definition then it is said to be reference type datatype.

value type memory allocated in stack
reference type memory allocated in heap

Inheritance is not support by the Value type members
Inheritance is support by the Reference type members

Value type data type are byte,int,uint,float,Double,decimal,char and bool
Reference type data type are string,class,objects,Enwn,interface and delegates

Is This Answer Correct ?    6 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are static and dynamic variables?

656


What is difference between const and static in c#?

500


What are methods in C#?

569


What is parameters in c#?

510


What is dataset and dataadapter in c#?

509






What are generations and how are they used by the garbage collector?

526


Why interface is required?

470


What is a static property. Give an example?

526


What is the use of ienumerable?

464


What is list collection in c#?

536


Is there hashmap in c#?

476


What do you mean by the delegate in c#?

517


Structs are not reference types. Can structs have constructors?

506


What do u mean by thread safe?

514


Define the term immutable ?

635