Question: I have a huge IEnumerable(suppose the name is myItems), which way is more effective?

Solution 1: Filter it first then ForEach.

```
Array.ForEach(myItems.Where(FILTER-IT-HERE).ToArray(),MY-ACTION);

```

Solution 2: Do RETURN in MY-ACTION if the item is not up to the mustard.

```
Array.ForEach(myItems.ToArray(),MY-ACTION-WITH-FILTER);

```

Is one of them always better than another? Or any other good suggestions? Thanks in advance.

Answer: 
Did you do any measurements? Since WE can't measure the run time of My-Action then only you can. Measure and decide.
If performance is a concern, it's unclear to me why you'd be bothering to construct an entire array in the first place. Why not just this?

```
foreach (var item in myItems.Where(FILTER-IT-HERE))
    MY-ACTION;

```

Or:

```
foreach (var item in myItems)
    MY-ACTION-WITH-FILTER;

```

I ask because, while the others are right that you can't really know without testing, I wouldn't expect there to be much difference between the above two options. I **would** expect there to be a difference, on the other hand, between creating/populating an array (seemingly for no reason) and *not* creating an array.