【发布时间】:2017-01-14 16:22:13
【问题描述】:
我有一个列表,每一行都是这样的:
CAR 1Z2 13 84 ... (200 hundred numbers) ... ZG2 // splitted by space
.
.
.
Repeated lines (around 1000 lines with different numbers)
和我的收藏:
public class Test
{
public string A { set; get; } // first value of line
public string B { set; get; } // second value of line
public double[] C { set; get; } // values[2-200]
public string A { set; get; } // last value of line
}
这是我的部分解决方案:
List<Test> test = new List<Test>();
foreach (string s in list)
{
var values = s.Split(null);
test.Add(new Test
{
A = values[0],
B = values[1],
C = double.Parse(values[2-200]), // ??
D = values[201],
});
}
如何将值 [2-200] 插入到 Collection 中的 C 数组中?
【问题讨论】:
标签: c# arrays collections