Improve the LINQ query returning indexes of items meeting a certain condition

I have this LINQ query which returns the indexes of all the items in an array whose time value (which is a double) meets a certain condition as in the below query.

var sonicIndices = completeLog.Select((item, index) => new { Item = item, Index = index })
            .Where(x => Math.Abs(x.Item.time - nullValue) > 0.001)
            .Select(item => item.Index).ToArray();

I am pretty sure that this can be improved but how? I am stumped. Can anyone help me in this?


I don't see anything particularly wrong with that, in what way does it need to be better? If you want a reusable method for this kind of thing, see: Getting a collection of index values using a LINQ query

Need Your Help

Using BigInteger in for-loop condition is not working. What should I do?

java loops biginteger

Another BigInteger problem. My code works for int and long, but since the test cases in UVa are larger, I need to use BigInteger. But I don't know how to use BigInteger and it drives me nuts! The c...

What native mysql class should I port to from Zend_Db? ( No PDO or Mysqli )

php mysql zend-db

I'm dealing with a client who has a legacy cPanel account where the php installation was not compiled with PDO nor Mysqli therefore my Zend_Db code is useless since it relies on either of those.