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.

ITupleTupleValueTuple和结构的显式接口实现。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.



返回指定 Tuple 元素的值。Returns the value of the specified Tuple element.


获取此 Tuple 实例中的元素数。Gets the number of elements in this Tuple instance.