C# 'ref' keyword, performance

后端 未结 4 780
南笙
南笙 2020-12-06 11:15

If you have a Bitmap object that needs to be passed to numerous methods (about 10), and finally to an event where it shall finally be disposed of after it\'s used, would it

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-06 11:50

    Bitmap is a reference type. Passing a reference type by value does not copy the object, merely the reference to the object. There would be no performance benefit to passing the Bitmap by reference instead of by value.

提交回复
热议问题