471,627 Members | 1,605 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

Which interface to implement

Hopefully someone can clarify some of this for me.
I am confused on what classes I should implement if I want to utilize the
List<>.BinarySearch() and Sort()
My class currently looks like:

public class MyClass : IComparable, IComparer, IEquatable<MyClass>

What do I NEED to implement?
I am consused looking at the documentation. It says that my class needs to
implement IComparer<T> or IComparable<T>???

Am I looking at this wrong? If I implement IComparable and IComparer am I
safe? Are the generic comparers used when your class doesn't implement
IComparer and you have to pass it in as a parameter?

I'm no word-smith, hopefully you understand what I am talking about. Any
input would be greatly appreciated.

Feb 10 '06 #1
2 1291
not sure if this will help you, but here is an article on MSDN talking
about sorting collections:


Feb 10 '06 #2

I have replied the issue in the CLR newsgroup! Thanks!

Yuan Ren [MSFT]
Microsoft Online Support

Feb 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Serge Calderara | last post: by
8 posts views Thread by Steven Livingstone | last post: by
6 posts views Thread by Ricky W. Hunt | last post: by
6 posts views Thread by greenxiar | last post: by
5 posts views Thread by Tony Johansson | last post: by
1 post views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.