This method uses the default comparer Comparer<(Of <(T>)>)..::.Default for type T to determine the order of list elements. The Comparer<(Of <(T>)>)..::.Default property checks whether type T implements the IComparable<(Of <(T>)>) generic interface and uses that implementation, if available. If not, Comparer<(Of <(T>)>)..::.Default checks whether type T implements the IComparable interface. If type T does not implement either interface, Comparer<(Of <(T>)>)..::.Default throws an InvalidOperationException.
The List<(Of <(T>)>) must already be sorted according to the comparer implementation; otherwise, the result is incorrect.
Comparing nullNothingnullptra null reference (Nothing in Visual Basic) with any reference type is allowed and does not generate an exception when using the IComparable<(Of <(T>)>) generic interface. When sorting, nullNothingnullptra null reference (Nothing in Visual Basic) is considered to be less than any other object.
If the List<(Of <(T>)>) contains more than one element with the same value, the method returns only one of the occurrences, and it might return any one of the occurrences, not necessarily the first one.
If the List<(Of <(T>)>) does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operation (~) to this negative integer to get the index of the first element that is larger than the search value. When inserting the value into the List<(Of <(T>)>), this index should be used as the insertion point to maintain the sort order.
This method is an O(log n) operation, where n is the number of elements in the range.