Tuples

Tuples are a convenient way to pack several values into one variable.

We'll cover the following...

Syntax

Tuples are a relatively new concept in C#. They first appeared in C# 7.0. Tuples provide a convenient way to work with several values.

A tuple is a set of values enclosed in parentheses:

(int, int) someTuple = (4, 2);

Here, we create a variable of type (int, int), which is a tuple of two int values. The order in which values are placed matters. We could declare the type ...