Getting the String that Represent the Value of ValueTuple<T1,T2> Instance in C# Last Updated : 11 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report ValueTuple is a structure introduced in C# 7.0 which represents the value type Tuple. It allows you to store a data set that contains multiple values that may or may not be related to each other. You can also get a string that represents the value of the ValueTuple's object with the help of the ToString Method. This method returns a string that will represent the value of the ValueTuple<T1, T2> object. The string represented by this method is in the form of (Item1, Item2) here Item1 and Item2 represent the values of Item1 and Item2 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 ValueTuple<T1, T2> object. Example 1: CSharp // C# program to illustrate // the use of ToString method using System; namespace exampleofvaluetuple{ class GFG { // Main Method static void Main(string[] args) { // 1-ValueTuple var v1 = ValueTuple.Create("Rina"); // Get the value of ValueTuple<T1> // With the help of ToString method Console.WriteLine("ValueTuple 1: " + v1.ToString()); // 2-ValueTuple var v2 = ValueTuple.Create("Rohan", 25); // Get the value of ValueTuple<T1, T2> // With the help of ToString method Console.WriteLine("ValueTuple 2: " + v2.ToString()); } } } Output: ValueTuple 1: (Rina) ValueTuple 2: (Rohan, 25) Example 2: CSharp // C# program to illustrate // the use of ToString method using System; namespace exampleofvaluetuple { class GFG{ // Main Method static void Main(string[] args) { // Nested Value Tuples var Emp1 = (Name:"Anu", Age: 23, Languages:ValueTuple.Create("C++", "Java", "Python", "C#")); var Emp2 = (Name:"Boond", Age:27, Post: "Junior Engineer", Languages:ValueTuple.Create("C++", "Java")); var Emp3 = (Name: "Rohit", Age: 25, Post: "HR", Languages: ValueTuple.Create("C++", "Java", "C#")); var Emp4 = (Name: "Mohan", Age: 26, Post: "Junior Engineer", Languages: ValueTuple.Create("C++", "Java", "Python")); // Get the value of Nested ValueTuples // With the help of ToString method Console.WriteLine("NValueTuple 1: {0}", Emp1.ToString()); Console.WriteLine("NValueTuple 2: {0}", Emp2.ToString()); Console.WriteLine("NValueTuple 3: {0}", Emp3.ToString()); Console.WriteLine("NValueTuple 4: {0}", Emp4.ToString()); } } } Output: NValueTuple 1: (Anu, 23, (C++, Java, Python, C#)) NValueTuple 2: (Boond, 27, Junior Engineer, (C++, Java)) NValueTuple 3: (Rohit, 25, HR, (C++, Java, C#)) NValueTuple 4: (Mohan, 26, Junior Engineer, (C++, Java, Python)) Comment More infoAdvertise with us A ankita_saini Follow Improve Article Tags : C# CSharp-ValueTuple CSharp-ValueTuple-Methods Similar Reads C# Tutorial C# (pronounced "C-sharp") is a modern, versatile, object-oriented programming language developed by Microsoft in 2000 that runs on the .NET Framework. Whether you're creating Windows applications, diving into Unity game development, or working on enterprise solutions, C# is one of the top choices fo 4 min read Introduction to .NET Framework The .NET Framework is a software development framework developed by Microsoft that provides a runtime environment and a set of libraries and tools for building and running applications on Windows operating systems. The .NET framework is primarily used on Windows, while .NET Core (which evolved into 6 min read C# Interview Questions and Answers C# is the most popular general-purpose programming language and was developed by Microsoft in 2000, renowned for its robustness, flexibility, and extensive application range. It is simple and has an object-oriented programming concept that can be used for creating different types of applications.Her 15+ min read C# Dictionary Dictionary in C# is a generic collection that stores key-value pairs. The working of Dictionary is quite similar to the non-generic hashtable. The advantage of a Dictionary is, that it is a generic type. A dictionary is defined under System.Collections.Generic namespace. It is dynamic in nature mean 5 min read C# List Class In C#, the List<T> class represents the list of objects that can be accessed by index. It comes under the System.Collections.Generic namespace. List class can be used to create a collection of different types like integers, strings, etc. List<T> class also provides the methods to search, 7 min read C# Delegates A delegate is an object which refers to a method or you can say it is a reference type variable that can hold a reference to the methods. It provides a way which tells which method is to be called when an event is triggered. For example, if you click on a Button on a form (Windows Form application), 6 min read ASP.NET Interview Questions and Answer ASP.NET is a popular framework by Microsoft for building fast and scalable web applications. It allows developers to create dynamic websites, services, and apps, using server-side code and offering a user-friendly experience. Trusted by companies like Microsoft, Dell, and Accenture, ASP.NET is used 15+ min read C# .NET Framework (Basic Architecture and Component Stack) C# (C-Sharp) is a modern, object-oriented programming language developed by Microsoft in 2000. It is a part of the .NET ecosystem and is widely used for building desktop, web, mobile, cloud, and enterprise applications. This is originally tied to the .NET Framework, C# has evolved to be the primary 6 min read C# Data Types Data types specify the type of data that a valid C# variable can hold. C# is a strongly typed programming language because in C# each type of data (such as integer, character, float, and so forth) is predefined as part of the programming language and all constants or variables defined for a given pr 7 min read C# Arrays An array is a group of like-typed variables that are referred to by a common name. And each data item is called an element of the array. The data types of the elements may be any valid data type like char, int, float, etc. and the elements are stored in a contiguous location. Length of the array spe 8 min read Like