C# | How to get Fifth Element of the Tuple? Last Updated : 30 Apr, 2019 Comments Improve Suggest changes Like Article Like Report Tuple is a data structure which gives you the easiest way to represent a data set which has multiple values that may/may not be related to each other. Item5 Property is used to get the fifth element of the given tuple. It is not applicable on 1-Tuple, 2-Tuple, 3-Tuple, and 4-Tuple but applicable on all other remaining tuples. Syntax: public T5 Item5 { get; } Here, T5 is the value of the current Tuple<> object's fifth component. This Tuple<> can be 5-tuple, or 6-tuple, or 7-tuple, or 8-tuple. Example: In the below code, you can see that we are accessing the fifth element of each tuple. CSharp // C# program to illustrate how to get // the fifth element of the tuple using System; class GFG { // Main method static public void Main() { // Taking 5-tuple var st5 = Tuple.Create("Siya", 22, "EEE", 2017, "20-Mar-1993"); Console.WriteLine("Student-5 DOB: " + st5.Item5); // Taking 6-tuple var st6 = Tuple.Create("Riya", 24, "ME", 2015, "30-May-1991", 230134832); Console.WriteLine("Student-6 DOB: " + st6.Item5); // Taking 7-tuple var st7 = Tuple.Create("Rohit", 21, "IT", 2017, "21-Apr-1994", 384749829, 20000); Console.WriteLine("Student-7 DOB: " + st7.Item5); // Taking 8-tuple var st8 = Tuple.Create("Manita", 24, "CSE", 2013, "03-Aug-1991", 235678909, 34000, "C#"); Console.WriteLine("Student-8 DOB: " + st8.Item5); } } Output: Student-5 DOB: 20-Mar-1993 Student-6 DOB: 30-May-1991 Student-7 DOB: 21-Apr-1994 Student-8 DOB: 03-Aug-1991 Note: You can also get the type of the fifth component of the tuple by using GetType() method or by using Type.GetGenericArguments method. Example: csharp // C# program to illustrate how to get the // type of the fifth element of the tuple using System; class GFG{ // Main method static public void Main (){ // Taking 5-tuple var stu5 = Tuple.Create("Siya", 22, "CSE",2017,101); Console.WriteLine("Student-5 ID: "+stu5.Item5); // Get the type of Item5 // Using GetType() method Console.WriteLine("Type of Item5: "+stu5.Item5.GetType()); // Get the type of Item5 // Using Type.GetGenericArguments method Type stu5type = stu5.GetType(); Console.WriteLine("Type of Item5: "+stu5type.GetGenericArguments()[4]); } } Output: Student-5 ID: 101 Type of Item5: System.Int32 Type of Item5: System.Int32 Comment More infoAdvertise with us Next Article C# | How to get Fifth Element of the Tuple? A ankita_saini Follow Improve Article Tags : C# CSharp-Tuple Similar Reads C# | How to get First Element of the Tuple? Tuple is a data structure which gives you the easiest way to represent a data set which has multiple values that may/may not be related to each other. Item1 Property is used to get the first element of the given tuple. It is applicable on every tuple like 1-Tuple, 2-Tuple, and so on. Syntax: public 2 min read C# | How to get Fourth Element of the Tuple? Tuple is a data structure which gives you the easiest way to represent a data set which has multiple values that may/may not be related to each other. Item4 Property is used to get the fourth element of the given tuple. It is not applicable on 1-Tuple, 2-Tuple, and 3-Tuple but applicable on all othe 2 min read How to get fifth Element of the ValueTuple in C#? ValueTuple is a structure introduced in C# 7.0 which represents the value type Tuple. It allows you to store a data set which contains multiple values that may or may not be related to each other. Item5 Property is used to get the fifth unnamed element of the given value tuple. It is applicable on e 2 min read C# | How to get Third Element of the Tuple? Tuple is a data structure which gives you the easiest way to represent a data set which has multiple values that may/may not be related to each other. Item3 Property is used to get the third element of the given tuple. It is not applicable on 1-Tuple, 2-Tuple but applicable on all other remaining tu 2 min read C# | How to get Sixth Element of the Tuple? Tuple is a data structure which gives you the easiest way to represent a data set which has multiple values that may/may not be related to each other. Item6 Property is used to get the sixth element of the given tuple. It is not applicable on 1-Tuple, 2-Tuple, 3-Tuple, 4-Tuple, and 5-Tuple but appli 2 min read Like