Created
November 1, 2017 03:28
-
-
Save Ibro/b066f955b6907dbc2bc3f761223cbe39 to your computer and use it in GitHub Desktop.
Desconstruction in C# 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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