Incorrect Loop-to-LINQ conversion in R#: 5.0.1530.25

Hi,

R# suggest convert following code:

  1. var zonesIndex = new Dictionary<Guid, int>();
  2. for (int i = 0; i < zoneArr.Length; i++) zonesIndex.Add(zoneArr[i].Id, i);


into

  1. var zonesIndex = zoneArr.ToDictionary<Zone, Guid, int>(t => t.Id, t => i);



where 'i' undefined.

Please sign in to leave a comment.