By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,848 Members | 1,598 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,848 IT Pros & Developers. It's quick & easy.

The generics IComparable<T>

P: n/a
Hello!

I'm reading in a book from Microsoft that the generic interface
IComparabler<Tdefine the two methods
CompareTo and Equals.

Now to my querstion if I look in the docs it says that CompareTo is defined
in the IComparabler<Tbut
the Equals is not mentioned.

Is this just a bad book telling me wrong thing?
Or do I misunderstand it in some way?

//Tony
Feb 12 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Feb 12, 9:45 am, "TonyJ" <johansson.anders...@telia.comwrote:
I'm reading in a book from Microsoft that the generic interface
IComparabler<Tdefine the two methods
CompareTo and Equals.

Now to my querstion if I look in the docs it says that CompareTo is defined
in the IComparabler<Tbut
the Equals is not mentioned.

Is this just a bad book telling me wrong thing?
Or do I misunderstand it in some way?
Do you mean IComparer<Tor IComparable<T>? They are two different
interfaces, but there's no such thing as IComparabler<T>.

In either case though, there's no Equals method. That appears in
IEquatable<Tand IEqualityComparer<T>.

Jon
Feb 12 '08 #2

P: n/a
The book is wrong (or is being taken out of context; hard to tell
without a citation); it inherits a few methods from object (Equals(),
GetHashCode(), GetType() and ToString() ) but the interface itself
only declares CompareTo().

Marc
Feb 12 '08 #3

P: n/a
Frther; there is a "bool Equals(T other)", but that is on
IEquatable<T>

Marc
Feb 12 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.