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 / gowthami

value types are stored in the memory.
reference types are stored in the heap.
all implicit datatypes,enums,structs are value types.
delegates,objects are reference types..
pointer to the heap where the data is located is maintained
in the stack
when we delete a reference type pointer to the heap is
deleted from the stack

Is This Answer Correct ?    3 Yes 0 No

What is difference between value and reference types ?..

Answer / nitin kumar tomar

Value types directly contain their data while reference
types store a references to variable's value memory
and value types uses stack to store data amd reference
types use heap to store data

Is This Answer Correct ?    2 Yes 0 No

What is difference between value and reference types ?..

Answer / 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

What is difference between value and reference types ?..

Answer / thirupathi reddy

value refers what is present in the address of the memory
Reference type refers to the address of the memory
Ex:
int a = 10( here the value stores in the address 'a' and the value of that address is 10)
int b = &a (here the variable b refers the address of
the variable a)
here if we print("%d",a) the value prints
here if we print("%d",b) the reference value of a is printed.
this is the difference between "value" and "reference values"

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Sharp Interview Questions

hi , how could i analyse a text the user added on a site to look for some words like "car" "shouffere" .. and then i can use that information in addition to other information to make a decision about the adds im going to to show on the site.

1 Answers  


Is string value type c#?

0 Answers  


What is the use of 0 in c#?

0 Answers  


What is Fragmentation and its Types?

0 Answers   MCN Solutions,


What are the types of comments in c#?

0 Answers  


What?s the top .NET class that everything is derived from?

3 Answers  


how can i display crystal report in button_click? am working with VS2005..........plz help me

1 Answers  


What is delay signing..??

1 Answers   HCL,


How do you create empty strings in c#?

0 Answers  


What is type safe in c#?

0 Answers  


What is difference between a function and a method?

0 Answers  


What is the use of oops in c#?

0 Answers  


Categories