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

前端 未结 30 1343
抹茶落季
抹茶落季 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:29

    "Are there any arguments I could use to help me convince him the for loop is acceptable to use?"

    No, if your boss is micromanaging to the level of telling you what programming language constructs to use, there's really nothing you can say. Sorry.

提交回复
热议问题