对变长数组使用foreach循环时,通常都要嵌套循环,才能得到该数据。


static void Main(string[] args)
 {
    
int[][] newArarry={new int[] {1},
                       
new int[] {1,2},
                       
new int[] {1,2,3},
                       
new int[] {1,2,3,4},
                       
new int[] {1,3},
                       
new int[] {1,2,3,4,5},
                       
new int[] {2,3,4},
                       
new int[] {3,5}};

    
foreach(int[] newArarry1 in newArarry)
    {
       
foreach(int newArarry2 in newArarry1)
       {
          Console.Write(newArarry2);
       }          
    }

   Console.ReadKey();

相关文章:

  • 2021-07-30
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
  • 2021-10-14
  • 2022-01-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案