What is difference between value and reference types ?

Answer Posted / narayansahu

value types are stored on stack whereas reference types are
stored on heap memory.
dim i as integer
or
int i

i here ia a value type and will be stored on stack.
Actually nearly all the basic types are implemented as a
structure.
where as
dim i as new Point()
(assuming point as a class)
i here is a referece variable(pointer) and will be stored
on stack where as The Point object will be created on heap
and i will point to it.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is ienumerable used?

491


What is global asax in c#?

510


Explain nullable types in c#?

527


What is a dictionary in c#?

482


Explain the feature of c# language?

494






Define a jagged array in c#?

472


What is yield break in c#?

499


Why do we use readonly in c#?

479


When a switch is said to be congested?

566


what is difference between is and as operators in c#?

526


What is the implicit name of the parameter that gets passed into the set method/property of a class?

491


Distinguish between the Debug class and Trace class with its functionality?

527


Does c# replace c++?

608


What are jump statements in c#?

493


What is icomparable in c#?

510