What's an efficient and hopefully elegant incantation to convert decimal[]
to double[]
?
I'm working with some fairly large arrays.
double[] doubleArray = Array.ConvertAll(decimalArray, x => (double)x);
You also can use and extension classes similar to this one
public static class ArrayExtension
{
public static double[] ToDouble(this float[] arr) =>
Array.ConvertAll(arr, x => (double)x);
}
Then:
double[] doubleArr = decimalArr.ToDouble();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With