C# 嵌套同步循环
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
5
namespace ConsoleApplication1
6
{
7
class Program
8
{
9
10
static void Main(string[] args)
11
{
12
int i = 0;
13
int [] BB = {1,2,3,4};
14
int [] CC = {1,2,3,4};
15
16
foreach(int a in BB )
17
{
18
for (; i < CC.Length;)
19
{
20
int h = CC[i];
21
i++;
22
break;
23
}
24
}
25
}
26
}
27
}
28
using System;2
using System.Collections.Generic;3
using System.Text;4

5
namespace ConsoleApplication16
{7
class Program8
{9
10
static void Main(string[] args)11
{12
int i = 0;13
int [] BB = {1,2,3,4};14
int [] CC = {1,2,3,4};15

16
foreach(int a in BB )17
{18
for (; i < CC.Length;)19
{20
int h = CC[i];21
i++;22
break;23
}24
}25
}26
}27
}28




浙公网安备 33010602011771号