When to use IComparable Vs. IComparer

前端 未结 8 1299
[愿得一人]
[愿得一人] 2020-11-29 16:07

I\'m trying to figure out which of these interfaces I need to implement. They both essentially do the same thing. When would I use one over the other?

8条回答
  •  忘掉有多难
    2020-11-29 16:55

    IComparable says an object can be compared with another. IComparer is an object that can compare any two items.

提交回复
热议问题