Passing by ref?

后端 未结 4 1014
无人共我
无人共我 2021-02-08 11:53

I am still confused about passing by ref.

If I have a Cache object which I want to be accessed/available to a number of objects, and I inject it using constructor inject

4条回答
  •  孤城傲影
    2021-02-08 12:22

    Objects are automatically passed by reference even when you declare them to be passed by value in function arguments, in the .NET framework.

    This is because the object itself is a reference type, so you can modify the members of the object, even though you cannot replace the object itself.

    See

    http://msdn.microsoft.com/en-us/library/aa903253(VS.71).aspx

提交回复
热议问题