Supposing that SomeMethod has signature
public IEnumerable<T> SomeMethod<T>();
is there any difference between
foreach (T tmp in SomeMethod<T>()) { ... }
and
IEnumerable<T> result = SomeMethod<T>();
foreach (T tmp in result) { ... }
In other words, will the results of SomeMethod<T> be cached on the first statement or will it be evaluated upon each iteration?