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