static void Test() {
var values = new[] { 1, 2, 3, 4, 5, 6, 7 };
// Using the GetLimits() function from previous example
var (min, max) = GetLimits(values);
Console.WriteLine($"Min value is {min}");
Console.WriteLine($"Min value is {max}");
}
// Alternative syntax for pre-existing variables:
static int _min;
static int _max;
static void Test() {
var values = new[] { 1, 2, 3, 4, 5, 6, 7 };
(_min, _max) = GetLimits(values); // No 'var' because we're not declaring new variables.
Console.WriteLine($"Min value is {_min}");
Console.WriteLine($"Min value is {_max}");
}
Code snippet taken from "Complete C# Quick Reference - C# 7".