Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
重複の可能性: IComparable<T> Vs を使用する場合。IComparer<T>
一方、IComparer は両方のケースで機能します。
その名のとおり、IComparable比較できるものでICompararあり、他のオブジェクトを比較できるオブジェクトです。同じタイプの 2 つのオブジェクトを比較する場合は、それに実装IComparableします。他のオブジェクトを比較できる型が必要な場合は、 を実装しIComparerます。
IComparable
IComparar
IComparer