value type variables contain the actual data directly and reference type variables contain the reference to the actual data.
I think of this as:
l.h.s is value type and r.h.s is reference type

on the left hand side, if I copy i into j, a new memory location is filled with same original data (45).
on the right hand side, if I copy k to l, a new memory location is filled with the reference to the object; and this reference points to the actual object in memory.
now, I am confused about this reference type copying. here’s a slight different thing:

Here, the copy on the r.h.s makes l points to same location as k.
My question is 1. “Which one is truer?” or is there more to it than I imagined?
Also, value types may be allocated on heap, depending upon the how jitter sees it fit, then 2. Can we force a reference type to be allocated on stack?
Sorry for sloppy image editing.
The first picture is better,
landkare different variables, occupying different places in memory.Actually it depends more on the context and the way a value is used. A value-type field would always be allocated on the heap, boxing and closures are other reasons.
However, the 2nd picture applies when
lis arefparameter:There is something like stackalloc but it’s an optimization that is ‘invisible’ to a C# programmer.
The simple and most useful answer is: No.