Item4 Property
Collapse the table of content
Expand the table of content

Tuple(Of T1, T2, T3, T4).Item4 Property

Gets the value of the current Tuple(Of T1, T2, T3, T4) object's fourth component.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Public ReadOnly Property Item4 As T4

Property Value

Type: T4
The value of the current Tuple(Of T1, T2, T3, T4) object's fourth component.

You can dynamically determine the type of the Item4 component in one of two ways:

  • By calling the GetType method on the value that is returned by the Item4 property.

  • By retrieving the Type object that represents the Tuple(Of T1, T2, T3, T4) object, and retrieving the fourth element from the array that is returned by its Type.GetGenericArguments method.

The following example defines an array of Tuple(Of T1, T2, T3, T4) objects whose components contain the name of a city, a month of the year, and the average high and low temperatures for that month. It then retrieves and displays the value of each component.

Imports System.Globalization

Module Example
   Public Sub Main()
      Dim temperatures() = 
             { Tuple.Create("New York, NY", 4, 61, 43), _
               Tuple.Create("Chicago, IL", 2, 34, 18), _ 
               Tuple.Create("Newark, NJ", 4, 61, 43), _
               Tuple.Create("Boston, MA", 6, 77, 59), _
               Tuple.Create("Detroit, MI", 9, 74, 53), _
               Tuple.Create("Minneapolis, MN", 8, 81, 61) } 
      ' Display the array of 4-tuples.
      Console.WriteLine("{0,41}", "Temperatures")
      Console.WriteLine("{0,-20} {1,5}    {2,4}  {3,4}", 
                        "City", "Month", "High", "Low")
      For Each temperature In temperatures
         Console.WriteLine("{0,-20} {1,5}    {2,4:N1}  {3,4:N1}", 
                           DateTimeFormatInfo.CurrentInfo.GetAbbreviatedMonthName(temperature.Item2 - 1), 
                           temperature.Item3, temperature.Item4)
   End Sub
End Module
' The example displays the following output:
'                                    Temperatures
'       City                 Month    High   Low
'       New York, NY           Mar    61.0  43.0
'       Chicago, IL            Jan    34.0  18.0
'       Newark, NJ             Mar    61.0  43.0
'       Boston, MA             May    77.0  59.0
'       Detroit, MI            Aug    74.0  53.0
'       Minneapolis, MN        Jul    81.0  61.0

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2016 Microsoft