Tuple<T1> Tuple<T1> Tuple<T1> Tuple<T1> Class

定义

表示 1 元组,即单一实例。Represents a 1-tuple, or singleton.

generic <typename T1>
public ref class Tuple : IComparable, System::Collections::IStructuralComparable, System::Collections::IStructuralEquatable
[System.Serializable]
public class Tuple<T1> : IComparable, System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable
type Tuple<'T1> = class
    interface IStructuralEquatable
    interface IStructuralComparable
    interface IComparable
Public Class Tuple(Of T1)
Implements IComparable, IStructuralComparable, IStructuralEquatable

类型参数

T1

元组的唯一一个分量的类型。The type of the tuple's only component.

继承
Tuple<T1>Tuple<T1>Tuple<T1>Tuple<T1>
属性
实现

注解

元组是具有特定数量和值序列的数据结构。A tuple is a data structure that has a specific number and sequence of values. Tuple<T1>类表示 1 元组或单一实例,是具有单个组件的元组。The Tuple<T1> class represents a 1-tuple, or singleton, which is a tuple that has a single component. 应用程序开发中,很少使用单一实例。A singleton is used comparatively rarely in application development.

可以实例化Tuple<T1>对象通过调用Tuple<T1>构造函数或静态Tuple.Create方法。You can instantiate a Tuple<T1> object by calling either the Tuple<T1> constructor or the static Tuple.Create method. 您可以使用只读的检索的值元组的单个组件Item1实例属性。You can retrieve the value of the tuple's single component by using the read-only Item1 instance property.

构造函数

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

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

属性

Item1 Item1 Item1 Item1

获取 Tuple<T1> 对象的单一分量的值。Gets the value of the Tuple<T1> object's single component.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

返回一个值,该值指示当前的 Tuple<T1> 对象是否与指定对象相等。Returns a value that indicates whether the current Tuple<T1> object is equal to a specified object.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

返回当前 Tuple<T1> 对象的哈希代码。Returns the hash code for the current Tuple<T1> object.

GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示此 Tuple<T1> 实例的值的字符串。Returns a string that represents the value of this Tuple<T1> instance.

显式界面实现

IComparable.CompareTo(Object) IComparable.CompareTo(Object) IComparable.CompareTo(Object) IComparable.CompareTo(Object)

将当前 Tuple<T1> 对象与指定对象进行比较,并返回一个整数,该整数指示当前对象在排序顺序中的位置是位于指定对象之前、之后还是与其位置相同。Compares the current Tuple<T1> object to a specified object, and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order.

IStructuralComparable.CompareTo(Object, IComparer) IStructuralComparable.CompareTo(Object, IComparer) IStructuralComparable.CompareTo(Object, IComparer) IStructuralComparable.CompareTo(Object, IComparer)

使用指定的比较器将当前的 Tuple<T1> 对象与指定对象进行比较,并返回一个整数,该整数指示当前对象在排序顺序中的位置是在指定对象之前、之后还是与其相同。Compares the current Tuple<T1> object to a specified object by using a specified comparer, and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order.

IStructuralEquatable.Equals(Object, IEqualityComparer) IStructuralEquatable.Equals(Object, IEqualityComparer) IStructuralEquatable.Equals(Object, IEqualityComparer) IStructuralEquatable.Equals(Object, IEqualityComparer)

返回一个值,该值根据指定的比较方法指示当前的 Tuple<T1> 对象是否与指定对象相等。Returns a value that indicates whether the current Tuple<T1> object is equal to a specified object based on a specified comparison method.

IStructuralEquatable.GetHashCode(IEqualityComparer) IStructuralEquatable.GetHashCode(IEqualityComparer) IStructuralEquatable.GetHashCode(IEqualityComparer) IStructuralEquatable.GetHashCode(IEqualityComparer)

使用指定的计算方法计算当前 Tuple<T1> 对象的哈希代码。Calculates the hash code for the current Tuple<T1> object by using a specified computation method.

ITuple.Item[Int32] ITuple.Item[Int32] ITuple.Item[Int32] ITuple.Item[Int32]

获取 Tuple 元素的值。Gets the value of the Tuple element.

ITuple.Length ITuple.Length ITuple.Length ITuple.Length

获取 Tuple 中的元素数。Gets the number of elements in the Tuple.

扩展方法

Deconstruct<T1>(Tuple<T1>, T1) Deconstruct<T1>(Tuple<T1>, T1) Deconstruct<T1>(Tuple<T1>, T1) Deconstruct<T1>(Tuple<T1>, T1)

将具有 1 个元素的元组解构为不同的变量。Deconstructs a tuple with 1 element into a separate variable.

ToValueTuple<T1>(Tuple<T1>) ToValueTuple<T1>(Tuple<T1>) ToValueTuple<T1>(Tuple<T1>) ToValueTuple<T1>(Tuple<T1>)

Tuple 类的实例转换为 ValueTuple 结构的实例。Converts an instance of the Tuple class to an instance of the ValueTuple structure.

适用于

另请参阅