What are the differences between the IComparer and IEqualityComparer interfaces?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

What are the differences between the IComparer and IEqualityComparer interfaces?

Rating:

The following table shows the differences between the IComparer and IEqualityComparer interfaces:

IComparerIEqualityComparer
The IComparer interface provides a method that compares two objects.The IEqualityComparer interface provides a method to support the comparison of objects for equality.
It provides a method named Compare() that compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.It provides two methods, namely Equal() and GetHashCode(). Equal() checks two objects for equality, whereas GetHashCode() returns a hash code for the specified object.
int Compare(Object x, Object y)
{
}
int CompareTo(Object x)
{
}
int Equals(Object obj1, Object obj2)
{
}
int GetHashCode(Object obj)
{
}


Rating:



Other articles

Click here to Article home

Microsoft Certification MCSE: MCSA , MCTS, MCDST, MCAD, MCDBA, MCSE Messaging, MCSE Security
JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.
 
HACKER SAFE certified sites prevent over 99.9% of hacker crime.