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. 您可以藉由抓取屬性的值來判斷元組中的專案數 LengthYou determine the number of items in the Tuple by retrieving the value of the Length property. 然後,您可以將範圍從零到一個小於屬性值的索引傳遞給屬性,以列舉其元素 Length Item[]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[] property.

ITuple 是類別和結構的明確介面實作為 Tuple ValueTupleITuple 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.



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


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