Tuple<T1> 類別

定義

代表 1-Tuple 或單一物件。

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

類型參數

T1

Tuple 之唯一元件的型別。

繼承
Tuple<T1>
屬性
實作

備註

Tuple 是具有特定數目和值序列的資料結構。 類別 Tuple<T1> 代表具有單一元件的 1 元組或單一元組。 單一在應用程式開發中很少使用。

您可以呼叫建構函式或靜態 Tuple.Create 方法來 Tuple<T1> 具現化 Tuple<T1> 物件。 您可以使用唯讀 Item1 實例屬性來擷取 Tuple 單一元件的值。

建構函式

Tuple<T1>(T1)

初始化 Tuple<T1> 類別的新執行個體。

屬性

Item1

取得 Tuple<T1> 物件之單一元件的值。

方法

Equals(Object)

傳回值,這個值表示目前的 Tuple<T1> 物件是否等於指定的物件。

GetHashCode()

傳回目前 Tuple<T1> 物件的雜湊碼。

GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回字串,表示這個 Tuple<T1> 執行個體的值。

明確介面實作

IComparable.CompareTo(Object)

將目前的 Tuple<T1> 物件與指定的物件進行比較,並且傳回一個整數,指出目前物件在排序順序中,究竟在指定物件的前面、後面還是相同位置。

IStructuralComparable.CompareTo(Object, IComparer)

使用指定的比較子將目前的 Tuple<T1> 物件和指定的物件進行比較,並且傳回一個整數,表示目前的物件在排序順序中位於指定之物件的前面、後面還是相的位置。

IStructuralEquatable.Equals(Object, IEqualityComparer)

傳回值,這個值表示依據指定的比較方法,目前的 Tuple<T1> 物件是否等於指定的物件。

IStructuralEquatable.GetHashCode(IEqualityComparer)

使用指定的計算方法,計算目前 Tuple<T1> 物件的雜湊碼。

ITuple.Item[Int32]

取得 Tuple 項目值。

ITuple.Length

取得 Tuple 中的項目數目。

擴充方法

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

將具有 1 個元素的元組解構為一個不同的變數。

ToValueTuple<T1>(Tuple<T1>)

Tuple 類別的執行個體轉換為 ValueTuple 結構的執行個體。

適用於

另請參閱