代码如下:
using System;
using System.Text;
using System.Collections.Generic;
class Test
{
static void Main(string[] args)
{
List<int[]> l=new List<int[]> {new int[]{1,2},new int[]{3,4}};
StringBuilder sb=new StringBuilder("\"[");
foreach(int[] arr in l)
{
sb.Append("[");
foreach(int e in arr)
{
sb.Append(e);
sb.Append(",");
}
sb.Remove(sb.Length-1,1);
sb.Append("],");
}
sb.Remove(sb.Length-1,1);
sb.Append("]\"");
Console.WriteLine(sb);
Console.ReadKey();
}
}
截图: