Is it possible for a function to return two values?

后端 未结 13 1537
谎友^
谎友^ 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:21

    In C# you can return more than one value using an out parameter. See example in the TryParse method of Int32 struct. It returns bool and an integer in an out parameter.

提交回复
热议问题