How can I copy an array of values to a destination array starting from a specific index without looping?
For example,if I have an array with 2 values, I have to copy those two elements to another array which has a capacity of 5 starting from index 3?
double[] source = new double[] {1, 2};
double[] destination = new double[5]{0,0,0,0,0};
//How to perform this copy?
double[] result = new double[5] {0, 0, 0, 1, 2};
Is this what you're looking for?
Array.Copy(source, 0 /*start loc*/, destination, 3 /*start loc*/, 2 /*count*/);
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