Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# return 2 values

// This is C# 7 and above
public static (int, int) Add_Multiply(int a, int b){
  return (a+b,a*b);
}
static void Main(string[] args)
{
  int a=10, b=20;
  int add, multiply;
  (add,multiply) = Add_Multiply(a, b);
  Console.WriteLine(add);
  Console.WriteLine(multiply);
}
 
PREVIOUS NEXT
Tagged: #return #values
ADD COMMENT
Topic
Name
9+7 =