A
tuple is a data structure that gives you the easiest way to represent a data set. You can also get a string that represents a tuple object by using the
ToString Method. This method returns a string that will represent the Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> object. The string represented by this method is in the form of (Item1, Item2, Item3, Item4, Item5, Item6, Item7, Item8..) here Item1, Item2, Item3, Item4, Item5, Item6, Item7 represent the values of Item1, Item2, Item3, Item4, Item5, Item6, Item7 properties, and Item8 represents the value of the Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> object's Next.Item1 property and the value of any additional nested components are followed by Item8. It will represent a
String.Empty if any property contains a null value.
Syntax:
public override string ToString ();
Return Type: The return type of this method is
System.String. So, it will return a string that represents Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> object.
Example 1:
Output:
Tuple 1: (Rohit)
Tuple 2: (Sheema, Riya)
Tuple 3: (Rima, Suman, Sohan)
Tuple 4: (Shilpa, Susma, Sumit, Rohan)
Example 2:
Output:
Tuple 5: (G, E, E, K, S)
Tuple 6: (C, C#, C++, Python, Java, Perl)
Tuple 7: (12, 45, 67, 78, 87, 97, 87)
Tuple 8: (G, E, E, K, S, F, O, (R, G, E, E, K, S))