1
Reply

What is difference between an reference type and value type in C#?

Rohan  Rathore

Rohan Rathore

11y
1.1k
0
Reply

    We can make difference between the datatypes of c# Ref type and value type. To get basic difference between value and ref datatypes we have to see how this datatypes are getting memory allocation in RAM. Value datatype are always getting memory allocation in stack memory of Ram memory and its variable and value are present at same place. But in case of Ref data types the value is present in the heap memory of ram memory and having one random addresses location and the variable is present in stack memory which pointing towards the value addresses present in heap.So in Ref datatype the variable is referring to the address of the its value.In this way we can make difference in Ref and value.datatypes. For similar kind of c# interview questions you can refer this link also. c# interview questions