C# Tuple ToString

Description

Tuple ToString returns a string that represents the value of this Tuple instance.

Syntax

Tuple<T1>.ToString has the following syntax.


public override string ToString()

Returns

Tuple<T1>.ToString method returns The string representation of this Tuple<T1> object.

Example

The following example illustrates the ToString method.


// w  ww  .j av a2s .  c  om
using System;

public class Example
{
   public static void Main()
   {
      var tuple1Double = Tuple.Create(3.456e-18);
      Console.WriteLine(tuple1Double.ToString());

      var tuple1String = Tuple.Create("Australia");
      Console.WriteLine(tuple1String.ToString());

      var tuple1Bool = Tuple.Create(true);
      Console.WriteLine(tuple1Bool.ToString());

      var tuple1Char = Tuple.Create('a');
      Console.WriteLine(tuple1Char.ToString());
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version