在固定长度或长度不需要计算的时候for循环效率高于foreach.
在不确定长度,或计算长度有性能损耗的时候,用foreach比较方便.
并且foreach的时候会锁定集合中的对象.期间不能修改.
posted on 2013-01-07 15:46 sisibest 阅读(229) 评论(0) 编辑 收藏 举报
Powered by: 博客园 Copyright © 2024 sisibest Powered by .NET 8.0 on Kubernetes