DataRowComparer<TRow> Class

Definition

通过使用基于值的比较来比较两个 DataRow 对象是否等值。Compares two DataRow objects for equivalence by using value-based comparison.

generic <typename TRow>
 where TRow : DataRowpublic ref class DataRowComparer sealed : System::Collections::Generic::IEqualityComparer<TRow>
public sealed class DataRowComparer<TRow> : System.Collections.Generic.IEqualityComparer<TRow> where TRow : DataRow
type DataRowComparer<'Row (requires 'Row :> DataRow)> = class
    interface IEqualityComparer<'Row (requires 'Row :> DataRow)>
Public NotInheritable Class DataRowComparer(Of TRow)
Implements IEqualityComparer(Of TRow)

Type Parameters

TRow

要进行比较的对象的类型,通常为 DataRowThe type of objects to be compared, typically DataRow.

Inheritance
DataRowComparer<TRow>
Implements

Remarks

此类实现 IEqualityComparer<T> 接口,并使用基于值的语义来比较 DataRow 的对象。This class implements the IEqualityComparer<T> interface and uses value-based semantics to compare DataRow objects. 此类是必需的,因为某些基于集的操作的默认实现(如 DistinctUnionIntersectExcept)使用基于引用的语义来比较 DataRow 对象引用,而不是比较 DataRow 对象的值。This class is required because the default implementations of some set-based operations (such as Distinct, Union, Intersect, and Except) use reference-based semantics to compare DataRow object references, instead of comparing the DataRow object values. Default 类用于比较 DataRow 对象的值,并且不比较对象引用。The Default class is used to compare the values of the DataRow objects and does not compare the object references.

不能直接实例化此类。This class cannot be directly instantiated. 相反,必须使用 Default 属性来返回 Default 类的单一实例。Instead, the Default property must be used to return a singleton instance of the Default class.

此类是无状态的。This class is stateless.

此类是密封的,不能从派生。This class is sealed and cannot be derived from.

Properties

Default

获取 DataRowComparer<TRow> 的单一实例。Gets a singleton instance of DataRowComparer<TRow>. 此属性为只读。This property is read-only.

Methods

Equals(Object)

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

(Inherited from Object)
Equals(TRow, TRow)

通过使用基于值的逐列比较来比较两个 DataRow 对象。Compares two DataRow objects by using a column-by-column, value-based comparison.

GetHashCode()

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

(Inherited from Object)
GetHashCode(TRow)

返回指定 DataRow 对象的哈希代码。Returns a hash code for the specified DataRow 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