Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Convert Int[][] to Double[][]?

Guys, sorry for asking basic question,

i have a problem here where I have a Int[][] jagged array, and I want to convert it to Double[][] jagged array. Of course I don't want to change the value inside the array for example:

int[2][1] = 25

and when it converted to double,

int[2][1] = 25

still the same.

here's my code,

value = File.ReadLines(filename)
            .Select(line => line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(MyIntegerParse)
                .ToArray()
                )
            .ToArray();

So i have value[][] which is type is integer. and i want to convert it to double.

Thanks for any help.

like image 667
Reza Avatar asked Apr 27 '11 08:04

Reza


1 Answers

Try:

.Select(x => (double)MyIntegerParse(x))
like image 67
Volkan Ceylan Avatar answered Oct 23 '22 15:10

Volkan Ceylan