mscorlib 4.0.0.0 System.Object

A tuple is a data structure that has a specific number and sequence of elements. An example of a tuple is a data structure with three elements (known as a 3-tuple or triple) that is used to store an identifier such as a person's name in the first element, a year in the second element, and the person's income for that year in the third element. The .NET Framework directly supports tuples with one to seven elements. In addition, you can create tuples of eight or more elements by nesting tuple objects in the property of a object.

Tuples are commonly used in four ways:

To represent a single set of data. For example, a tuple can represent a database record, and its components can represent individual fields of the record.

To provide easy access to, and manipulation of, a data set.

To return multiple values from a method without using out parameters (in C#) or ByRef parameters (in Visual Basic).

To pass multiple values to a method through a single parameter. For example, the method has a single parameter that lets you supply one value to the method that the thread executes at startup time. If you supply a object as the method argument, you can supply the thread’s startup routine with three items of data.

The class does not itself represent a tuple. Instead, it is a class that provides static methods for creating instances of the tuple types that are supported by the .NET Framework. It provides helper methods that you can call to instantiate tuple objects without having to explicitly specify the type of each tuple component.

Although you can create an instance of a tuple class by calling its class constructor, the code to do so can be cumbersome. The following example uses a class constructor to create a 7-tuple or septuple that contains population data for New York City for each census from 1950 through 2000.

code reference: System.Tuple.Class#1

Creating the same tuple object by using a helper method is more straightforward, as the following example shows.

code reference: System.Tuple.Class#2

The helper methods directly support the creation of tuple objects that have from one to eight components (that is, singletons through octuples). Although there is no practical limit to the number of components a tuple may have, helper methods are not available to create a tuple with nine or more components. To create such a tuple, you must call the constructor.

For additional information and examples that use tuples, see the documentation for the individual tuple types in the .NET Framework. These are listed in the See Also section at the end of this topic.

Provides static methods for creating tuple objects.

- Method
  4.0.0.0
  System.Tuple<T1> `` To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Tuple<T1,T2> `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Tuple<T1,T2,T3> `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Tuple<T1,T2,T3,T4> `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Tuple<T1,T2,T3,T4,T5> `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Tuple<T1,T2,T3,T4,T5,T6> `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Tuple<T1,T2,T3,T4,T5,T6,T7> `` `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Tuple<T1,T2,T3,T4,T5,T6,T7,System.Tuple<T8>> `` `` `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.