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
Can a constructor have a return type?
What is the difference between system.string and system.text.stringbuilder classes?
Is it possible to have different access modifiers on the get/set methods of a property?
Can You Prevent Your Class From Being Inherited By Another Class?
Can list contain duplicates c#?
Which attribute adorn a test class to be picked up by the NUnit GUI in the NUnit test framework?
Is as keyword in c#?
How we convert private assembly into public assembly?
Explain how is the dll hell problem solved in .net?
Is learning c# hard?
How does insertion sort work?
What is the role of the datareader class in ado.net connections?
What is the purpose of namespace?
How to use reflection to call generic method?
How do you determine whether a string represents a numeric value?