You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 22, 2018. It is now read-only.
I'll just post the failing code snippet. Should be self explanatory ;)
var range1 = new Stack<int>(); range1.Push(1); // This will hit the IEnumerable branch of LastIndexOf method.
var range2 = new[] { 1 }; // This will hit the IList branch of LastIndexOf method.
Console.WriteLine(range1.IndexOf(x => x == 1)); // 0
Console.WriteLine(range2.IndexOf(x => x == 1)); // 0
Console.WriteLine(range1.LastIndexOf(x => x == 1)); // 0
Console.WriteLine(range2.LastIndexOf(x => x == 1)); // -1 Incorrect!
The text was updated successfully, but these errors were encountered:
This seemed like a small enough fix that I couldn't bother with a pull request.
I didn't notice at first, but actually the implementation for the IEnumerable branch is also broken and will return the first index instead of the last one.
Hello!
I'll just post the failing code snippet. Should be self explanatory ;)
The text was updated successfully, but these errors were encountered: