Pair Class

Definition

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

public ref class Pair
public ref class Pair sealed
public class Pair
[System.Serializable]
public sealed class Pair
type Pair = class
Public Class Pair
Public NotInheritable Class Pair
Inheritance
Pair
Attributes

Remarks

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. Pair 类不封装其对象引用,First 并在属性中 Second;它将它们直接公开给作为公共类字段的所有调用代码。The 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以及 ControlStateSecondIn this case, the First property is used for ViewState, and the Second for ControlState.

Constructors

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.

Fields

First

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

Second

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

Methods

Equals(Object)

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

(Inherited from Object)
GetHashCode()

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

(Inherited from Object)
GetType()

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

(Inherited from Object)
MemberwiseClone()

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

(Inherited from Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also