This is probably not the best way to do this, but it is not an easy way to do this using LINQ.
float[] numbers = { 0f, 0f, 0f, 1f, 1.6f, 2.5f, 3.5f, 2.51f, 1.0f, 0f, 0f, 0f, 2.52f, 3.5f, 6.5f, 4.5f, 1.2f, 1.0f, 2.53f, 3.5f }; int count = numbers.Where((n, i) => i > 0 && n > 1.5f && numbers[i - 1] < 1.5f).Count();
source share