//下列for写法比一般的for写法要快很多,时间紧 ,大概的思路是其只需要计算一次length
1 int[] arr={1,2,3,4,5,6}; 2 for(int i=0,iLen=arr.Length;i<iLen;i++) //必须是显示申明,不能var 3 { 4 ........... 5 }
C# for循环提升效率的写法
猜你喜欢
转载自www.cnblogs.com/ybqjymy/p/12170823.html
今日推荐
周排行