是什么的IEqualityComparer℃之间的差异; T>和IEquatable< T&GT ;? [英] What is the difference between IEqualityComparer<T> and IEquatable<T>?

查看:186
本文介绍了是什么的IEqualityComparer℃之间的差异; T>和IEquatable< T&GT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解的场景中 的IEqualityComparer< T> IEquatable< T> 应该被使用。
MSDN文档看起来都非常相似。

I want to understand the scenarios where IEqualityComparer<T> and IEquatable<T> should be used. The MSDN documentation for both looks very similar.

推荐答案

的IEqualityComparer< T> 为执行对象的接口该类型的两个对象的比较 T

IEqualityComparer<T> is an interface for an object that performs the comparison on two objects of the type T.

IEquatable< T> 是类型的对象 T 以便它可以自身比较到另一个

IEquatable<T> is for an object of type T so that it can compare itself to another.

这篇关于是什么的IEqualityComparer℃之间的差异; T&GT;和IEquatable&LT; T&GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆