- Let's take a look at the calling code again. We can further simplify the code in the static void Main method by getting rid of the var s. When we called the GetAverageAndCount() method, we returned the Tuple into var s.
var s = ch1.GetAverageAndCount(scores);
- We do not have to do this. C# 7.0 allows us to immediately split the Tuple into its respective parts as follows:
var (average, studentCount) = ch1.GetAverageAndCount(scores);
- We can now consume the values returned by the Tuple directly as follows:
WriteLine($"Average was {average} across {studentCount} students");
- Before we implement the GetAverageAndCount() method, make sure that your static void Main method looks as follows:
static void Main(string[] ...