Tuple(T1, T2) Class represents a 2-tuple, or pair. : Tuple « Data Types « VB.Net






Tuple(T1, T2) Class represents a 2-tuple, or pair.

 

Module Example
    Public Sub Main()
        Dim scores() As Tuple(Of String, Nullable(Of Integer)) =
                        {New Tuple(Of String, Nullable(Of Integer))("A", 78),
                          New Tuple(Of String, Nullable(Of Integer))("B", 84)}
        Dim number As Integer
        ComputeMean(scores, number)
    End Sub
    Private Function ComputeMean(ByVal scores() As Tuple(Of String, Nullable(Of Integer)), ByRef n As Integer) As Double
        For Each score In scores
            Console.WriteLine(score.Item2.HasValue)
            Console.WriteLine(score.Item2.Value)
        Next score
        Return 0

    End Function
End Module

   
  








Related examples in the same category

1.Tuple Class provides static methods for creating tuple objects.
2.Creates a new 1-tuple, or singleton.
3.Create Tuple with New operator
4.Tuple.Create(T1, T2) creates a new 2-tuple, or pair.
5.Tuple.Create(T1, T2, T3) Method creates a new 3-tuple, or triple.
6.Tuple.Create(T1, T2, T3, T4) Method creates a new 4-tuple, or quadruple.