What is a Tuple? How many values can a Tuple Hold?

  • A Tuple is a data structure which can hold data of multiple types in a single variable.
  • Tuple was first introduced in .NET 4.0.
  • A Tuple can generally represent a row in a database table, where each column can represent a different type.
  • Individual values of "Items" inside a single tuple variable can be accessed by means of properties (Item1, Item2, ..)
  • A tuple can hold a maximum of 8 Items in itself, where the individual Items can themselves be Tuples of different items.
var tuple = new Tuple<T1, T2, T3, ... , T7, T8>();

C# Concepts Posted Mar 25, 2021

You can now show your support. 😊

We use cookies to provide you with a great user experience, analyze traffic and serve targeted promotions.   Learn More   Accept