For example I want to return multiple value from this function
public int,int Sum(int a,int b)
{
return (a,b);
}
For example I want to return multiple value from this function
public int,int Sum(int a,int b)
{
return (a,b);
}
In the code below, you notice that we have defined a function, calculated the minimum and maximum values and then returned a Tuple of type<int,int> back to the calling method. This lets the compiler know that a tuple having 2 integer values is being returned back.
public Tuple<int,int> MultipleReturnsFromSUM(int a, int b)
{
int min, max;
if (a > b)
{
max = a;
min = b;
}
else
{
max = b;
min = a;
}
return new Tuple<int, int>(min, max);
}
For your case just use value tuple.
public (int,int) Sum(int a,int b)
{
return (a,b);
}