In .NET, which loop runs faster, 'for' or 'foreach'?

前端 未结 30 1339
抹茶落季
抹茶落季 2020-11-22 04:25

In C#/VB.NET/.NET, which loop runs faster, for or foreach?

Ever since I read that a for loop works faster than a foreach

30条回答
  •  旧巷少年郎
    2020-11-22 04:31

    Jeffrey Richter talked the performance difference between for and foreach on a recent podcast: http://pixel8.infragistics.com/shows/everything.aspx#Episode:9317

提交回复
热议问题