【发布时间】:2011-04-27 08:48:49
【问题描述】:
各位,抱歉问了个基本问题,
我有一个问题,我有一个Int[][] 锯齿状数组,我想将它转换为Double[][] 锯齿状数组。当然,我不想更改数组中的值,例如:
int[2][1] = 25
当它转换为双精度时,
int[2][1] = 25
还是一样。
这是我的代码,
value = File.ReadLines(filename)
.Select(line => line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
.Select(MyIntegerParse)
.ToArray()
)
.ToArray();
所以我有 value[][] 类型是整数。我想把它转换成双倍。
感谢您的帮助。
【问题讨论】:
-
尝试投
(double)MyIntegerParse -
抱歉,放在哪里?在 .Select(MyIntegerParse) 中?
-
.Select((double)MyIntegerParse) -
@Stecya:其实他应该用
.Select(x => (double)MyIntegerParse(x)) -
@digEmAll :你是对的。应该像回答一样发布它