dotnet / dotnet/dotnet-api-docs
The method returns a negative integer even though the list does contain the specified value
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
I had a list of strings with 116 items, and the item I searched for (e.g., 10_10101_007_dffa2972-c01e-420b-be5a-e1f15ec71abd) was at index 95, but the BinarySearch() returned the index as -104.
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 6840eba6-7752-b6d2-951a-75b34b6991a8
* Version Independent ID: 99656b6c-a5ba-682b-4743-015e55607f06
* Content: [List<T>.BinarySearch Method (System.Collections.Generic)](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.binarysearch?view=netframework-4.7.2)
* Content Source: [xml/System.Collections.Generic/List`1.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Collections.Generic/List`1.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**
Contributor guide
Assessment
This issue has not been assessed yet.