IEnumerable when I get a real reference on the objects?
Posted
by Steve
on Stack Overflow
See other posts from Stack Overflow
or by Steve
Published on 2010-03-31T14:04:57Z
Indexed on
2010/03/31
14:13 UTC
Read the original article
Hit count: 204
IEnumerable<T> collection;
void MyMethod(T toSearch)
{
foreach (T t in collection)
if (t == toSearch) {}
}
The if clause is never true.. is it because the Enumerator creates all the items instances on demand, so everytime a new Reference ?
© Stack Overflow or respective owner