What is the Difference between value and reference type?
Answer Posted / rita ghosal
REFERENCE TYPE=In contrast to value types, the value of a reference types is allocated on the heap. Another name for a reference type, that you might be more familiar with, is an object. Reference types stores the reference to the data, unlike value types, that stores the value. To demonstrate the difference between a reference type and a value type, let's look
VALUE TYPE=The value of value types are stored on the managed stack, and can be used directly. This means that the value is stored, and not a reference to the value. This also means that each value type has its own copy of the data. Reference Types on the other hand has a reference to the data, and several variables can reference the same data.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between static and private constructor?
What is the difference between function and method in c#?
What is delegate in c#?
Can a struct have a default constructor (a constructor without parameters) or a destructor in c#?
What is session and cookies in c#?
Explain how many types of exception handlers are there in .net?
Why do we need encapsulation in c#?
What is the use of xmlserializer?
Why singleton pattern is used in c#?
What is the use of convert toint32 in c#?
What is an argument in c#?
Is there hashmap in c#?
What is mean by c#?
Can I define a type that is an alias of another type (like typedef in c++)?
What are collections in c#?