what is the difference between value types and reference
types?

Answer Posted / susant

Value type - bool, byte, decimal, double, enum , float,
int, long, short, strut, uint, ulong,
Value types are stored in the Stack
Reference type - class, delegate, interface, object, string
Reference types are stored in the Heap

Value types : Value types directly contain their data, and
instances of value types are either allocated on the stack
or allocated inline in a structure. Value types can be
built-in (implemented by the runtime), user-defined, or
enumerations.

Reference types : Reference types store a reference to the
value's memory address, and are allocated on the heap.
Reference types can be self-describing types, pointer
types, or interface types. The type of a reference type can
be determined from values of self-describing types. Self-
describing types are further split into arrays and class
types. The class types are user-defined classes, boxed
value types, and delegates.

Variables that are value types each have their own copy of
the data, and therefore operations on one variable do not
affect other variables. Variables that are reference types
can refer to the same object; therefore, operations on one
variable can affect the same object referred to by another
variable. All types derive from the System.Object base type.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Object Caching in Visual Studio 2010?

672


What is textbox control of .net mobile? : Microsoft dot net mobile

703


What re interop services?

653


What is the purpose of hard disk? : Dot net architecture

599


Define dma? : Dot net architecture

630






What is the application frame host?

622


Explain the difference between primary & secondary storage device? : Dot net architecture

593


What is application frame host?

693


.Net Frame work arch?

1696


What is the purpose of cache? How is it used? : Dot net architecture

573


how to use custom field validation

2135


Explain the race around condition? How can it be overcome? : Dot net architecture

619


Can you explain control extenders?

595


Name some changes done since version 3.0?

631


What's the difference between an application and a program?

669