Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Desconstruction in C# 7
(int highest, int lowest) = GetLowestHighest(numbers);
// Notice the return type of the method. It is tuple
private static(int, int) GetLowestHighest(IReadOnlyCollection < int > numbers) {
int lowest = numbers.Min(n => n);
int highest = numbers.Max(n => n);
return (lowest, highest);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.