What is the benefit of using out/ref versus returning?

前端 未结 2 859
庸人自扰
庸人自扰 2021-01-17 20:03

I\'m making a game using XNA framework, so I use a lot functions that operate on vectors. (especially Vector2 (64bit struct)). What bothers me is that most of the methods ar

2条回答
  •  北海茫月
    2021-01-17 20:33

    Another difference on top of the performance efficience mentioned by Servy is the ability to have multiple "return" values: instead of returning them the usual way, you list them as ref/var parameters.

提交回复
热议问题