Which interface to implement

P

preport

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.
 
Y

Yuan Ren[MSFT]

Hi,

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

Yuan Ren [MSFT]
Microsoft Online Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top