Pair 类

定义

提供用于存储两个相关对象的基本实用工具类。Provides a basic utility class that is used to store two related objects.

public ref class Pair sealed
[System.Serializable]
public sealed class Pair
type Pair = class
Public NotInheritable Class Pair
继承
Pair
属性

注解

Pair类用作存储两个相关对象的基本结构。The Pair class is used as a basic structure to store two related objects. 它是一个实用工具类, 它在 ASP.NET 的各种方式 (如页面状态管理任务或配置节处理程序中) 使用。It is a utility class that is used in various ways throughout ASP.NET, such as during page state management tasks or in configuration section handlers. 您可以在您Pair自己的代码中使用类, 该结构需要包含两个相关对象的结构, 并且数据隐藏不是必需的。You can use the Pair class in your own code anywhere that you need a structure to contain two related objects and where data hiding is not essential. 类不封装其对象引用, FirstSecond在属性中将它们直接公开给作为公共类字段的所有调用代码。 PairThe Pair class does not encapsulate its object references, First and Second, in properties; it exposes them directly to all calling code as public class fields.

Pair类可以在页状态持久性实现中通过多种方式使用。The Pair class can be used in several ways in page state persistence implementations. 最常见的用途是作为ViewStateControlState集合的容器。The most common use is as a container for both the ViewState and ControlState collections. 在这种情况下First , 属性ViewState用于, 和Second ControlState用于。In this case, the First property is used for ViewState, and the Second for ControlState.

构造函数

Pair()

创建 Pair 类的未初始化的新实例。Creates a new, uninitialized instance of the Pair class.

Pair(Object, Object)

使用指定的对象对初始化 Pair 类的新实例。Initializes a new instance of the Pair class, using the specified object pair.

字段

First

获取或设置该对象对的第一个对象。Gets or sets the first object of the object pair.

Second

获取或设置该对象对的第二个对象。Gets or sets the second object of the object pair.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

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

(继承自 Object)
MemberwiseClone()

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

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅