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


Please Help Members By Posting Answers For Below Questions

What are anonymous functions in c#?

524


Explain the types of assemblies in .net?

531


Explain partial class in c#?

497


What is sealed class in c#?

521


What do you mean by hashtable c#?

573






What is join in c#?

484


Give an example of a ctype.

563


Why do we use static methods in c#?

534


Is string primitive?

498


Which string method is used for concatenation of two strings in c#?

473


What is dynamic dispatch?

552


What is default class in c#?

505


Explain the types of errors in c#?

483


Why we use dll in c#?

549


What is writeline?

485