When should I use out parameters?

后端 未结 10 1346
温柔的废话
温柔的废话 2020-12-08 06:34

I don\'t understand when an output parameter should be used, I personally wrap the result in a new type if I need to return more than one type, I find that a lot easier to w

10条回答
  •  心在旅途
    2020-12-08 06:48

    Creating a type just for returning values sounds little painful to me :-) First i will have to create a type for returning the value then in the calling method i have assign the value from the returned type to the actual variable that needs it.

    Out parameters are simipler to use.

提交回复
热议问题