Is it possible for a function to return two values?

后端 未结 13 1484
谎友^
谎友^ 2020-12-31 08:41

Is it possible for a function to return two values? Array is possible if the two values are both the same type, but how do you return two different type values?

相关标签:
13条回答
  • 2020-12-31 09:46

    Not directly. Your options are either to return some kind of custom struct or class with multiple properties, use KeyValuePair if you simply want to return two values, or use out parameters.

    0 讨论(0)
提交回复
热议问题