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
Why do I get a syntax error when trying to declare a variable called checked?
What is event and delegates in c#?
What is .edmx file?
What is enumerable in c#?
Is int a class in c#?
How can I access the registry from c# code?
What exactly is serverless?
What is session variable in c#?
Is string nullable c#?
What is access specifier in c#?
What is c# best for?
How can you set image source dynamically from c# application to ”test.png” file?
You have got 1 million parking slots. At a time a parking slot can be free or not. To get next slot easily which data structure to implement?
What is Covariance and contravariance in C#?
Why do we need generics in c#?