class Program
{
static void Main(string[] args)
{
List<List<double>> myList = new List<List<double>>();
myList.Add(new List<double> { 2D, 2D, 3D, 5D, 8D, 11D, 13D, 13D, 11D, 8D, 5D, 3D });
myList.Add(new List<double> { 6D, 7D, 10D, 14D, 18D, 21D, 22D, 22D, 19D, 15D, 10D, 7D });
List<List<KeyValuePair<string, double>>> result = new List<List<KeyValuePair<string, double>>>();
for (int i = 0; i < myList.Count; i++)
{
List<KeyValuePair<string, double>> r = new List<KeyValuePair<string, double>>();
for (int j = 0; j < myList[i].Count; j++)
{
r.Add(new KeyValuePair<string, double>("Values", myList[i][j]));
}
result.Add(r);
}
foreach(var element in result)
{
Console.WriteLine(element);
Console.ReadLine();
}
}
}
我想打印列表“结果”的内容。上面的 foreach 循环不起作用。打印列表的正确方法是什么?
千巷猫影
红糖糍粑
紫衣仙女
相关分类