ITuple 介面

定義

定義一般用途的元組實作,允許存取元組執行個體成員,不需要知道基礎的元組類型。Defines a general-purpose Tuple implementation that allows access to Tuple instance members without knowing the underlying Tuple type.

public interface class ITuple
public interface ITuple
type ITuple = interface
Public Interface ITuple
衍生

備註

您可以使用 ITuple 介面來存取元組實例的個別元素,而不需要事先知道元組中的元素數目或類型。You use the ITuple interface to access individual elements of a Tuple instance without knowing beforehand the number or types of elements in the Tuple. 您可以藉由抓取 Length 屬性的值來判斷元組中的專案數。You determine the number of items in the Tuple by retrieving the value of the Length property. 接著,您可以將範圍從零到小於 Length 屬性值的索引傳遞至 Item[Int32] 屬性,藉以列舉其元素。You can then enumerate its elements by passing an index that ranges from zero to one less than value of the Length property to the Item[Int32] property.

ITupleTuple 類別和 ValueTuple 結構的明確介面實。ITuple is an explicit interface implementation of the Tuple classes and the ValueTuple structures. 您必須先將 Tuple 物件轉換成 ITuple 介面物件,才能存取其屬性。You must cast the Tuple object to an ITuple interface object before you can access its properties.

屬性

Item[Int32]

傳回指定的 Tuple 項目值。Returns the value of the specified Tuple element.

Length

取得此 Tuple 執行個體中的元素數。Gets the number of elements in this Tuple instance.

適用於