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:
| 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 CompareTo(Object x) { } | { } int GetHashCode(Object obj) { } |
Rating:
Was this information helpful?
Other articles
- What is a delegate?
- How to add files to a Setup package?
- What is a cryptanalyst?
- How to use the BufferedStream class?
- What is the COM Interop Service?
