

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get Fifth Element of the Tuple in C#?
<p>To get the fifth element of the Tuple, the code is as follows −</p><h2>Example</h2><p><a class="demo" href="http://tpcg.io/FEc3JQOl" rel="nofollow" target="_blank"> Live Demo</a></p><pre class="prettyprint notranslate">using System; public class Demo { public static void Main(String[] args){ var tuple1 = Tuple.Create(75, 200, 500, 700, 100, 1200, 1500); var tuple2 = Tuple.Create(75, 200, 500, 700, 100, 1200, 1500); Console.WriteLine("Is Tuple1 equal to Tuple2? = "+tuple1.Equals(tuple2)); Console.WriteLine("HashCode of Tuple1 = "+tuple1.GetHashCode()); Console.WriteLine("HashCode of Tuple2 = "+tuple2.GetHashCode()); Console.WriteLine("Tuple1 Item 5th = "+tuple1.Item5); Console.WriteLine("Tuple2 Item 5th = "+tuple2.Item5); } }</pre><h2>Output</h2><p>This will produce the following output −</p><pre class="result notranslate">Is Tuple1 equal to Tuple2? = True HashCode of Tuple1 = 3231587 HashCode of Tuple2 = 3231587 Tuple1 Item 5th = 100 Tuple2 Item 5th = 100</pre><h2>Example</h2><p>Let us see another example −</p><p><a class="demo" href="http://tpcg.io/GGjSt2xk" rel="nofollow" target="_blank"> Live Demo</a></p><pre class="prettyprint notranslate" style="">using System; public class Demo { public static void Main(String[] args){ var tuple = Tuple.Create(1200, 1500, 2200, 2700, 3100, 3500, 4500, 5500); Console.WriteLine("HashCode of Tuple = "+tuple.GetHashCode()); Console.WriteLine("Tuple Item 1st = "+tuple.Item1); Console.WriteLine("Tuple Item 2nd = "+tuple.Item2); Console.WriteLine("Tuple Item 3rd = "+tuple.Item3); Console.WriteLine("Tuple Item 4th = "+tuple.Item4); Console.WriteLine("Tuple Item 5th = "+tuple.Item5); Console.WriteLine("Tuple Item 6th = "+tuple.Item6); Console.WriteLine("Tuple Item 7th = "+tuple.Item7); } }</pre><h2>Output</h2><p>This will produce the following output −</p><pre class="result notranslate">HashCode of Tuple = 49989024 Tuple Item 1st = 1200 Tuple Item 2nd = 1500 Tuple Item 3rd = 2200 Tuple Item 4th = 2700 Tuple Item 5th = 3100 Tuple Item 6th = 3500 Tuple Item 7th = 4500</pre>
- Related Questions & Answers
- How to get Sixth Element of the Tuple in C#?
- How to get Third Element of the Tuple in C#?
- How to get Second Element of the Tuple in C#?
- How to get Seventh Element of the Tuple in C#?
- How to get First Element of the Tuple in C#?
- How to get Fourth Element of the Tuple in C#?
- How to get the HashCode of the tuple in C#?
- Get tuple element data types in Python
- How to get the remaining elements of the Tuple in C#?
- Fifth root of a number in C++
- Get the size of the LabelValue Tuple in Java
- Python How to get the last element of list
- How to get the first element of the List in Java?
- Fifth Normal Form (5NF)
- Getting the Type of the Tuple’s Element in C#
Advertisements