using System;
namespace Csharp
{
class Program
{
static void Main()
{
int[] a = new int[] { 1,2,3,4,5,6,7,8};
foreach (var temp in a)
{
temp++; //出错,不能改变迭代值
Console.WriteLine(temp);
}
Console.ReadLine();
}
}
}
C#中foreach不能改变迭代值
最新推荐文章于 2022-06-05 21:48:17 发布