Skip to content

Instantly share code, notes, and snippets.

@Ibro Ibro/Tuples.cs

Created Oct 28, 2017
What would you like to do?
Tuples in C# 7
List<int> numbers = new List<int> { 3, 5, 11, 4, 7 };
var someTupleResult = GetSomeTuple(numbers);
// This is much better!
// tuple with 3 params and named return parameters
private static(int lowest, int highest, string LuckyName) GetSomeTuple(IReadOnlyCollection < int > numbers) {
int lowest = numbers.Min(n => n);
int highest = numbers.Max(n => n);
return (lowest, highest, "Johnny Boy");
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.