What is a tuple?

A Tuple can be thought of much like an array, but a Tuple collection can contain different data types. Classes of the Tuple type are generic containers and can hold 1-8 items.

Syntax

Tuple<int,string,int[]> myTuple = Tuple.Create(101, "Hello", new int[] { 41, 52 });

Example: Instantiate and access a tuple

To access the information within a Tuple, use the name of the Tuple and then .Item1, .Item2, and so on.

Get hands-on with 1400+ tech skills courses.