What is difference between value and reference types?

Answers were Sorted based on User's Feedback



What is difference between value and reference types?..

Answer / payal


value
this stored actual value

reference
stored the address of the value

value store in stack
reference is stored in heap

the variable which are value type they each time create
their own copy
the variable which are reference type they refer the same
object every time

Is This Answer Correct ?    5 Yes 1 No

What is difference between value and reference types?..

Answer / chaitanya.k

Value types allocates the values in stack
Reference types allocates the value references in Heap

Is This Answer Correct ?    5 Yes 2 No

What is difference between value and reference types?..

Answer / surya

Value Type holds the data within this own memory allocation.

where as Reference Type contains a pointer to another
memory location that holds the data.

Is This Answer Correct ?    1 Yes 0 No

What is difference between value and reference types?..

Answer / shiva charan

Moreover added to the above points

if two reference variables are pointing to the same
location, change in one reference variable will reflect the
other referenc variable.

Is This Answer Correct ?    1 Yes 0 No

What is difference between value and reference types?..

Answer / kartheeksirangipatel

ValueType:
-->Value types holds data directly.
-->Nodefault value for valuetype
-->valuetype stored in stack memory
-->Stack is not accessible to Garbage collector
Ex--->Predefined datatypes
Structures
Enumarator
Reference type:
-->Ref type does not holds the datadirectly
-->Ref type holds the default value
-->ref type will be stored in Heap memory
-->Heap is accessible to garbage collector
Ex--->Arryas
Classes
Objects
Deligates
Interfaces

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More C Sharp Interview Questions

Why is it a bad idea to throw your own exceptions?

1 Answers   Visual Soft,


What is dataview c#?

0 Answers  


Is there a way of specifying which block or loop to break out of when working with nested loops?

0 Answers  


What is a dbml?

0 Answers  


what is uniary operators and binary operators and what is the difference

1 Answers   Protech,


How do you convert byte array to hexadecimal string, and vice versa?

0 Answers  


What is immutable in C#?

0 Answers   SwanSoft Technologies,


Helo , Help Me , Help Me About : C# Windows Application - Network How To Manage IP Client's Accessiblity To The Internet Share concise Substitute , Minor ISA Server

0 Answers  


Distinguish between a class and struct?

0 Answers  


what is application domain?

4 Answers   Kanbay,


What is threading in c# with example?

0 Answers  


what is accessspecifier and explation each with example?

3 Answers  


Categories