Tuple<T1,T2,T3,T4,T5,T6,T7>.ToString Metoda

Definicja

Zwraca ciąg reprezentujący wartość tego Tuple<T1,T2,T3,T4,T5,T6,T7> wystąpienia.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Zwraca

Reprezentacja ciągu tego Tuple<T1,T2,T3,T4,T5,T6,T7> obiektu.

Przykłady

Poniższy przykład definiuje Tuple<T1,T2,T3,T4,T5,T6,T7> obiekt, który zawiera dane populacji dla Nowego Jorku dla każdego spisu z 1950 do 2000 roku. Składniki sekstuple są następnie wyświetlane przez wywołanie ToString metody .

using System;

public class Example
{
   public static void Main()
   {
      // Get population data for New York City, 1960-2000.
      var population = Tuple.Create("New York", 7891957, 7781984, 
                                    7894862, 7071639, 7322564, 8008278);
      Console.WriteLine(population.ToString());
   }
}
// The example displays the following output:
//    (New York, 7891957, 7781984, 7894862, 7071639, 7322564, 8008278)
open System

// Get population data for New York City, 1960-2000.
let population = 
    Tuple.Create("New York", 7891957, 7781984, 7894862, 7071639, 7322564, 8008278)
printfn $"{population}"
// The example displays the following output:
//    (New York, 7891957, 7781984, 7894862, 7071639, 7322564, 8008278)
Module Example
   Public Sub Main()
      ' Get population data for New York City, 1960-2000.
      Dim population = Tuple.Create("New York", 7891957, 7781984, 
                                    7894862, 7071639, 7322564, 8008278)
      Console.WriteLine(population.ToString())                                 
   End Sub
End Module
' The example displays the following output:
'       (New York, 7891957, 7781984, 7894862, 7071639, 7322564, 8008278)

Uwagi

Ciąg zwrócony przez tę metodę przyjmuje postać (Item1, Item2, Item3, Item4, ), gdzie Item1, Item2, Item3, Item4Item5, Item6, Item7, Item5, Item6 i Item7 reprezentują odpowiednio wartości Item1właściwości , Item2, Item4Item5Item3, Item6i .Item7 Jeśli którakolwiek z wartości właściwości to null, jest reprezentowana jako String.Empty.

Dotyczy