This can be achieved by returning a tuple.
A tuple is actually a collection of small values. Specifying a list of types in a method definition instructs it to return a tuple.
At the same time, the return statement in the method body must also specify a value list to be returned. Note that the types must correspond one to one.
(int,int) cal(...)
{
int val1;
int val2;
...//计算val1和val2的值
return (val1,val2)
}
When calling a method, provide a corresponding list of variables to hold the results.
int reVal1 , reVal2;
(reVal1,reVal2) = cal(...);
But vs2017 must add a package to support tuples.
Tools->NuGet Package Manager->Manage NuGet packages for solutions->Browse
SearchValueTuple _
Check the items and install them on a single machine
OK in the preview changes dialog