What is Tuple?
Tuple is a type of class which once created, cannot change the type of fields. Tuple is a fixed type ordered sequence. A tuple is an ordered list of elements. In mathematics, an n-tuple is an ordered list of n elements, where n is a non-negative integer, like tuple has stored seven elements and more than seven elements are also possible.
Names,
- A 2 tuple is called a pair.
- A 3 tuple is called a tripple.
- A 4-tuple is called a quadruple.
- A 5-tuple is called a quintuple.
- A 6-tuple is called a sextuple.
- A 7-tuple is called a septuple.
Larger tuples are called n-tuples
Tripple Example:Three items stored in one tuple is called tripple; in this I wrote one example for this tripple,
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace TuppleApplication
- {
- class Program
- {
- static void Main(string[] args)
- {
- Tuple<string, int, int> tupple = new Tuple<string, int, int>("blue", 1, 2);
- if(tupple.Item1=="blue")
- {
- Console.WriteLine(tupple.Item1);
- }
- if(tupple.Item2==1)
- {
- Console.WriteLine(tupple.Item2);
- }
- if(tupple.Item3==2)
- {
- Console.WriteLine(tupple.Item3);
- }
- Console.ReadLine();
- }
- }
- }
var tupple=Tupple.create("red",1);
Saravanakumar SekaranPosted May 10, 2017, 3:12 AM
Wow really nice article
Sachin KumarPosted Oct 12, 2016, 2:47 AM
Can you please do spell Check? At many places you have written Tripple/Tupple instead of Tuple and also the tag that added in the end is "Tupple" not Tuple. Please correct this.
SubashPosted Oct 4, 2016, 5:46 AM
Very nice one if you share uses or advantages or benifits of tuple it will very useful
Nagaharitha JinkaPosted Sep 21, 2016, 1:22 AM
Thanks
Sinraj VPosted Sep 21, 2016, 12:47 AM
Nice one..