本文整理匯總了VB.NET中System.Tuple<T1,T2,T3,T4,T5,T6>類的典型用法代碼示例。如果您正苦於以下問題:VB.NET Tuple<T1,T2,T3,T4,T5,T6>類的具體用法?VB.NET Tuple<T1,T2,T3,T4,T5,T6>怎麽用?VB.NET Tuple<T1,T2,T3,T4,T5,T6>使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Tuple<T1,T2,T3,T4,T5,T6>類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Example
Module Example
Public Sub Main()
' Get population data for New York City, 1960-2000.
Dim population = Tuple.Create(
"New York", 7781984, 7894862, 7071639, 7322564, 8008278)
Dim rate = ComputePopulationChange(population)
' Display results.
Console.WriteLine("Population Change, {0}, 1960-2000", population.Item1)
Console.WriteLine()
Console.WriteLine("Year {0,10} {1,9}", "Population", "Annual Rate")
Console.WriteLine("1960 {0,10:N0} {1,11}", population.Item2, "NA")
Console.WriteLine("1970 {0,10:N0} {1,11:P2}", population.Item3, rate.Item2/10)
Console.WriteLine("1980 {0,10:N0} {1,11:P2}", population.Item4, rate.Item3/10)
Console.WriteLine("1990 {0,10:N0} {1,11:P2}", population.Item5, rate.Item4/10)
Console.WriteLine("2000 {0,10:N0} {1,11:P2}", population.Item6, rate.Item5/10)
Console.WriteLine("1960-2000 {0,10:N0} {1,11:P2}", "", rate.Item6/50)
End Sub
' Compute rate of population change by decade and overall.
Private Function ComputePopulationChange(data As Tuple(Of String, Integer, Integer, Integer, Integer, Integer)) _
As Tuple(Of String, Double, Double, Double, Double, Double)
Dim rate = Tuple.Create(data.Item1,
(data.Item3 - data.Item2)/data.Item2,
(data.Item4 - data.Item3)/data.Item3,
(data.Item5 - data.Item4)/data.Item4,
(data.Item6 - data.Item5)/data.Item5,
(data.Item6 - data.Item2)/data.Item2 )
Return rate
End Function
End Module
輸出:
Population Change, New York, 1960-2000 Year Population Annual Rate 1960 7,781,984 NA 1970 7,894,862 0.15 % 1980 7,071,639 -1.04 % 1990 7,322,564 0.35 % 2000 8,008,278 0.94 % 1960-2000 0.06 %