开发者

Would there be any performance difference between these 2 IEnumerable<T> codes using foreach?

var effects = this.EffectsRecursive;
foreach ( Effect effect in effects )
{
...
}

vs

开发者_开发知识库
foreach ( Effect effect in this.EffectsRecursive )
{
...
}


No, the foreach operates on the result of the call to IEnumerable.GetEnumerator, which will get called only once either way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜