Passing objects by reference/value in C#

Many developers’ knowledge about passing object as parameters can be summed up with the following “In c# object parameters are always being passed by reference, if i will pass some object to another code, the same object will be in context”. While this knowledge is sufficient for most of the cases, it might cause bugs in a few. Lets take a look at some code snippet:

© 2021 Yoni Goldberg. All rights reserved.