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> object. The string represented by this method is in the form of (Item1, Item2, Item3, Item4, Item5, Item6, Item7) here Item1, Item2, Item3, Item4, Item5, Item6, Item7 represent the values of Item1, Item2, Item3, Item4, Item5, Item6, Item7 properties. And 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> 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: (2, 4, 6, 8, 10)
Tuple 6: (3, 6, 9, 12, 15, 18)
Tuple 7: (12, 45, 67, 78, 87, 97, 87)