Loop can be converted into a LINQ expression not showing up

Answered

Hi,

I'm using JetBrains ReSharper Ultimate 2016.1  Build 105.0.20160414.153548

I used a simple example, but the option "Loop can be converted into a LINQ expression not showing up" doesn't show up like in this page (https://blog.jetbrains.com/dotnet/2009/12/11/resharper-50-preview-loops-2-linq/):

using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace ClassLibrary1
{
  public class Developer
  {
    public bool Available { get; set; }

  }

  public class Class1
  {
    public int Test()
    {
      IEnumerable<Developer> developers = new List<Developer>(3);
      int count = 0;
      foreach (var developer in developers)
      {
        if (developer.Available == false)
        {
          count++;
        }
      }
      return count;
    }

  }

}

My settings are like in the next image:

How to get the suggestion to refactor the code into a linq expression, like in the blog given as example?

Thanks,

Miguel

1 comment
Comment actions Permalink
Official comment

Hello Miguel,

Please try looking for "Loop can be converted into LINQ-expression" inspection here ReSharper | Options | Code Inspection | Inspection Severity. 

Thanks! 

Please sign in to leave a comment.