Open In App

Getting the String that Represent the Value of the Tuple<T1,T2,T3> Instance in C#

Last Updated : 12 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report
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> object. The string represented by this method is in the form of (Item1, Item2, Item3) here Item1, Item2, Item3 represent the values of Item1, Item2, Item3 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> object. Example 1:
Output:
Tuple 1: (Rohit)
Tuple 2: (Sheema, Riya)
Tuple 3: (Rima, Suman, Sohan)
Example 2:
Output:
NTuple 1: (Sumit, (Bongo, Bella, Binu))
NTuple 2: (Boond, Cinki, Chimmy, (Karan, Micky))
NTuple 3: (34.9, 78.7, (12.2, 34.5, 5.6, 0.78))
NTuple 4: (2, 4, 6, 8, 5, (10, 20, 30, 40, 50))

Article Tags :

Similar Reads