Tuple<T1>(T1) Tuple<T1>(T1) Tuple<T1>(T1) Tuple<T1>(T1) Constructor

定义

初始化 Tuple<T1> 类的新实例。Initializes a new instance of the Tuple<T1> class.

public:
 Tuple(T1 item1);
public Tuple (T1 item1);
new Tuple<'T1> : 'T1 -> Tuple<'T1>
Public Sub New (item1 As T1)

参数

item1
T1 T1 T1 T1

元组的唯一一个分量的值。The value of the tuple's only component.

注解

你还可以使用静态Tuple.Create方法实例化1元组对象, 而无需显式指定其组件的类型。You can also use the static Tuple.Create method to instantiate a 1-tuple object without having to explicitly specify the type of its component. 下面的示例使用Create方法实例化1元组, 其组件的类型Int32为。The following example uses the Create method to instantiate a 1-tuple whose component is of type Int32.

var tuple1 = Tuple.Create(12);
Console.WriteLine(tuple1.Item1);     // Displays 12
Dim tuple1 = Tuple.Create(12)
Console.WriteLine(tuple1.Item1)     ' Displays 12

这等效于对Tuple<T1>类构造函数的以下调用。This is equivalent to the following call to the Tuple<T1> class constructor.

var tuple1 = new Tuple<int>(12);
Console.WriteLine(tuple1.Item1);     // Displays 12
Dim tuple1 = New Tuple(Of Integer)(12)
Console.WriteLine(tuple1.Item1)     ' Displays 12

适用于