Binary Search a List of custom data types to match just one field

前端 未结 4 1670
清酒与你
清酒与你 2021-01-21 15:07

I have a List:

List allStudents = new List(); 

that contains over 94,000 Student objects, where Student is define

4条回答
  •  独厮守ぢ
    2021-01-21 15:27

    Define the IComparable interface for your Student class. Then all the sort and comparison methods of your list, including BinarySearch() will you use this one automatically.

提交回复
热议问题