
Tuples provide a straightforward way to store a set of values. The main purpose of tuples is to safely return multiple values from a method without resorting to out parameters (something you cannot do with anonymous types). The simplest way to create a literal tuple is to list the desired values in parentheses. This creates a tuple with unnamed elements:

Unlike with anonymous types, var is optional and you can specify a tuple type explicitly:

This means that you can usefully return a tuple from a method:

Tuples play well with generics, so the following types are all legal

Tuples are value types with mutable (read/write) elements. This means that you can modify Item1, Item2, and so on, after creating a tuple.
Naming Tuple Elements
You can optionally give meaningful names to elements when creating tuple literals:

You can do the same when specifying tuple types:

Deconstructing Tuples
Tuples implicitly support the deconstruction pattern (see “Deconstructors”), so you can easily deconstruct a tuple into individual variables. Consider the following:

With the tuple’s deconstructor, you can simplify the code to this:

The syntax for deconstruction is confusingly like the syntax for declaring a tuple with named elements! The following highlights the difference:
