Tuple<T1,T2,T3,T4,T5,T6>.Item6 Tuple<T1,T2,T3,T4,T5,T6>.Item6 Tuple<T1,T2,T3,T4,T5,T6>.Item6 Tuple<T1,T2,T3,T4,T5,T6>.Item6 Property

Definition

Ruft den Wert der sechsten Komponente des aktuellen Tuple<T1,T2,T3,T4,T5,T6>-Objekts ab.Gets the value of the current Tuple<T1,T2,T3,T4,T5,T6> object's sixth component.

public:
 property T6 Item6 { T6 get(); };
public T6 Item6 { get; }
member this.Item6 : 'T6
Public ReadOnly Property Item6 As T6

Eigenschaftswert

T6 T6 T6 T6

Der Wert der sechsten Komponente des aktuellen Tuple<T1,T2,T3,T4,T5,T6>-Objekts.The value of the current Tuple<T1,T2,T3,T4,T5,T6> object's sixth component.

Beispiele

Im folgenden Beispiel wird ein Array von Tuple<T1,T2,T3,T4,T5,T6> -Objekten definiert, deren Komponenten auffüllungs Daten für drei US-amerikanische Städte (New York, Chicago und Los Angeles) zwischen 1960 und 2000 enthalten.The following example defines an array of Tuple<T1,T2,T3,T4,T5,T6> objects whose components contain population data for three U.S. cities (New York, Chicago, and Los Angeles) from 1960 through 2000. Daraufhin wird eine Tabelle angezeigt, in der die Daten aufgelistet sind.It then displays a table that lists the data. Um die Auffüllung in 2000 anzuzeigen, ruft Sie den Wert der Item6 -Eigenschaft für jedes Tuple<T1,T2,T3,T4,T5,T6> -Objekt ab.To display the population in 2000, it retrieves the value of the Item6 property for each Tuple<T1,T2,T3,T4,T5,T6> object.

using System;
using System.Text.RegularExpressions;

public class Class1
{
   public static void Main()
   {
      // Create tuples containing population data for New York, Chicago, 
      // and Los Angeles, 1960-2000.
      Tuple<string, int, int, int, int, int>[] cities =
           { Tuple.Create("New York", 7781984, 7894862, 7071639, 7322564, 8008278),
             Tuple.Create("Los Angeles", 2479015, 2816061, 2966850, 3485398, 3694820),
             Tuple.Create("Chicago", 3550904, 3366957, 3005072, 2783726, 2896016) };

      // Display tuple data in table.
      string header = "Population in";
      Console.WriteLine("{0,-12} {1,60}", 
                        "City", new String('-',(60-header.Length)/2) + header + 
                                new String('-', (60-header.Length)/2));
      Console.WriteLine("{0,25}{1,12}{2,12}{3,12}{4,12}\n", 
                        "1960", "1970", "1980", "1990", "2000");         

      foreach (var city in cities)                      
         Console.WriteLine("{0,-12} {1,12:N0}{2,12:N0}{3,12:N0}{4,12:N0}{5,12:N0}", 
                           city.Item1, city.Item2, city.Item3, city.Item4, 
                           city.Item5, city.Item6);
   }
}
// The example displays the following output:
//    City          -----------------------Population in-----------------------
//                         1960        1970        1980        1990        2000
//    
//    New York        7,781,984   7,894,862   7,071,639   7,322,564   8,008,278
//    Los Angeles     2,479,015   2,816,061   2,966,850   3,485,398   3,694,820
//    Chicago         3,550,904   3,366,957   3,005,072   2,783,726   2,896,016
Module Example
   Public Sub Main()
      ' Create tuples containing population data for New York, Chicago, 
      ' and Los Angeles, 1960-2000.
      Dim cities() =
           { Tuple.Create("New York", 7781984, 7894862, 
                          7071639, 7322564, 8008278),
             Tuple.Create("Los Angeles", 2479015, 2816061, 
                          2966850, 3485398, 3694820),
             Tuple.Create("Chicago", 3550904, 3366957, 
                          3005072, 2783726, 2896016) }

      ' Display tuple data in table.
      Dim header As String = "Population in"
      Console.WriteLine("{0,-12} {1,60}", 
                        "City", New String("-"c,(60-header.Length)\2) + header + _
                                New String("-"c, (60-header.Length)\2))
      Console.WriteLine("{0,25}{1,12}{2,12}{3,12}{4,12}", 
                        "1960", "1970", "1980", "1990", "2000")                  
      Console.WriteLine()
      For Each city In cities                      
         Console.WriteLine("{0,-12} {1,12:N0}{2,12:N0}{3,12:N0}{4,12:N0}{5,12:N0}", 
                           city.Item1, city.Item2, city.Item3, city.Item4, 
                           city.Item5, city.Item6)
      Next
   End Sub
End Module
' The example displays the following output:
'    City          -----------------------Population in-----------------------
'                         1960        1970        1980        1990        2000
'    
'    New York        7,781,984   7,894,862   7,071,639   7,322,564   8,008,278
'    Los Angeles     2,479,015   2,816,061   2,966,850   3,485,398   3,694,820
'    Chicago         3,550,904   3,366,957   3,005,072   2,783,726   2,896,016

Hinweise

Der Typ der Item6 Komponente kann auf zwei Arten dynamisch bestimmt werden:You can dynamically determine the type of the Item6 component in one of two ways:

  • Durch Aufrufen der GetType -Methode für den Wert, der von der Item6 -Eigenschaft zurückgegeben wird.By calling the GetType method on the value that is returned by the Item6 property.

  • Durch Abrufen des Type Objekts, das das Tuple<T1,T2,T3,T4,T5,T6> Objekt darstellt, und Abrufen des ersten Elements aus dem Array, das von seiner Type.GetGenericArguments -Methode zurückgegeben wird.By retrieving the Type object that represents the Tuple<T1,T2,T3,T4,T5,T6> object, and retrieving the first element from the array that is returned by its Type.GetGenericArguments method.

Gilt für: