Question: Suppose the following code:

```
foreach(Item i on ItemCollection)
{
   Something s = new Something();
   s.EventX += delegate { ProcessItem(i); };
   SomethingCollection.Add(s);
}

```

Of course, this is wrong because all the delegates points to the same Item. The alternative is:

```
foreach(Item i on ItemCollection)
{
   Item tmpItem = i;
   Something s = new Something();
   s.EventX += delegate { ProcessItem(tmpItem); };
   SomethingCollection.Add(s);
}

```

In this case all the delegates point to their own Item.

What about this approach? There is any other better solution?

Answer: 
The second chunk of code is just about the best approach you can get all other things staying the same.

However, it may be possible to create a property on `Something` which takes `Item`. In turn the event code could access this `Item` off the sender of the event or it might be included in the eventargs for the event. Hence eliminating the need for the closure.

Personally I've added "Elimination of Unnecessary Closure" as a worthwhile refactoring since it can be difficult to reason on them.
The problem you are facing here is related to such language construct as **closure**.
Second piece of code fixes the problem.