I know what passing by ref is and what it means, but what exactly happens with the objects passed by ref? Is it guaranteed that the objects stay at their current position in memory while the reference is being used?
Does it make a difference whether the variables are locals or not?
I'm mostly interested with what happens in memory.
A bit of background information: I have written a simple test program that stores the memory address of objects passed by ref and noticed how C# likes to move objects around in memory. But what I think is odd was that the objects being used were locals of a function. This automatically makes me think that the object's reference can't move in memory because it is on the stack. But clearly I'm missing something. What kind of memory was I receiving when using the ref?