C# Tuple ToString
Description
Tuple ToString
returns a string that
represents the value of this Tuple instance.
Syntax
Tuple<T1, T2>.ToString
has the following syntax.
public override string ToString()
Returns
Tuple<T1, T2>.ToString
method returns The string representation of this
Tuple<T1, T2> object.
Example
The following example illustrates the ToString method.
/* w ww . jav a 2 s. com*/
using System;
public class Class1
{
public static void Main()
{
Tuple<string, Nullable<int>>[] scores =
{ new Tuple<string, Nullable<int>>("A", 2),
new Tuple<string, Nullable<int>>("B", 8),
new Tuple<string, Nullable<int>>("C", null),
new Tuple<string, Nullable<int>>("D", 1) };
foreach (var score in scores)
Console.WriteLine(score.ToString());
}
}
The code above generates the following result.