Does passing Reference Types using ref save memory?

后端 未结 4 512

In C#, the parameters to a method can be either reference types or value types. When passing reference types, a copy of the reference is passed. This way, if inside a method

4条回答
  •  灰色年华
    2021-01-04 20:20

    Passing reference type by value does not copy the object. It only creates new reference to existing object. So you should not pass it by reference unless you really need to.

提交回复
热议问题