You could to this:
var items = GetItems();
foreach (var item in items)
{
// some code
}
Edit - in response to the comment, I agree with what astander is saying, but I actually prefer to not do "inline" method calls inside other constructs (method calls, if statements, loops, etc.). For example, if you have a method call that looks like this:
var result = SomeMethod(GetCode(), GetItems(), GetSomethingElse(), aVariable);
I think it's actually easier to read and debug if you do this instead:
var code = GetCode();
var items = GetItems();
var somethingElse = GetSomethingElse();
var result = SomeMethod(code, items, somethingElse, aVariable);
With the second way, you can more easily set a breakpoint on the method you actually want to step into, rather than having to step over other method calls before stepping into the method you want to debug. Just a personal preference.