Tuple(Of T1, T2) Constructor (T1, T2)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of the Tuple(Of T1, T2) class.

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

Public Sub New (
	item1 As T1,
	item2 As T2
)

Parameters

item1
Type: T1

The value of the tuple's first component.

item2
Type: T2

The value of the tuple's second component.

You can also use the static Tuple.Create(Of T1, T2)(T1, T2) method to instantiate a 2-tuple object without having to explicitly specify the types of its components. The following example uses the Tuple.Create(Of T1, T2)(T1, T2) method to instantiate a 2-tuple whose components are of type String and Double.

Dim tuple2 = Tuple.Create("New York", 32.68)
Console.WriteLine("{0}: {1}", tuple2.Item1, tuple2.Item2)
' Displays New York: 32.68

This is equivalent to the following call to the Tuple(Of T1, T2) class constructor.

Dim tuple2 = New Tuple(Of String, Double)("New York", 32.68)
Console.WriteLine("{0}: {1}", tuple2.Item1, tuple2.Item2)
' Displays New York: 32.68

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show: