Hi,
The generic interface IEquatable is an interface which will compare an
object against another object to see if they are equal. It has one method
for you to implement, the Equals( T obj ) method. This is pretty similar
to the System.Object.Equals method you maybe thinking, but the difference
is that the Object.Equals method that all classes have, is not type
specific, while the IEquatable interface is a generic type and will be
type-safe. When thinking about value types this comes into play even more
because with the Object.Equals, we have to box/unbox those values in order
to compare them, while our type-safe version of IEquatable will not need to
box the value type.
If you are using generic version of Queue<>, then either overriding
Object.Equals or implementing IEquatable<> will work. But the latter is
recommended since it has better performance. If you are using non generic
version of Queue, then only overriding Object.Equals will work.
Regards,
Walter Wang (
[email protected], remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.