C# - What does passing by ref do? : I know what passing by ref is and what it means but what exactly does it do with the objects passed by ref?

Does it guarantee the objects to stay at their current position in memory while the reference is being used?

Does the behavior change between local objects and global objects?

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?