I have to use a method which accepts double[,], but I only have a double[]. How can I convert it?
Solution so far:
var array = new double[1, x.Length];
foreach (var i in Enumerable.Range(0, x.Length))
{
array[0, i] = x;
}
There's no direct way. You should copy stuff into a double[,]
. Assuming you want it in a single row:
double[,] arr = new double[1, original.Length];
for (int i = 0; i < original.Length; ++i)
arr[0, i] = original[i];
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