So today I discovered that c# passes reference types by value by default. This ran counter to what I thought I understood - reference types are by reference as standard. Oh well.

This led me to think about a method that I had that took an entity object as a parameter, attached to a context, and made some changes to it. The method did not return the object. When calling save changes on my context, the changes made within the method were applied.
I assumed at the time that it worked because I was passing a reference to the object and so could happily alter it without having to return anything to reassign.

So the question is, how does this work? (the code did work as I expected).

Thanks,