
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Tuple Rest Property in C#
Create tuples of eight or more elements by nesting tuple objects in the Rest property.
The tuple would look like −
Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>
Above, the 8th element is added using Rest property.
Let us see an example.
Example
using System; public class Program { public static void Main() { var myTuple = Tuple.Create(1, 2.5M, "Tom", "100", 5, 10.5M, "Henry", "100"); Console.WriteLine("Item1 : "+ myTuple.Item1); Console.WriteLine("Item2 : "+ myTuple.Item2); Console.WriteLine("Item3 : "+ myTuple.Item3); Console.WriteLine("Item4 : "+ myTuple.Item4); Console.WriteLine("Item5 : "+ myTuple.Item5); Console.WriteLine("Item6 : "+ myTuple.Item6); Console.WriteLine("Item7 : "+ myTuple.Item7); Console.WriteLine("Item8 : "+ myTuple.Rest); } }
Output
Item1 : 1 Item2 : 2.5 Item3 : Tom Item4 : 100 Item5 : 5 Item6 : 10.5 Item7 : Henry Item8 : (100)
Advertisements