# How to copy partial values from one main array to a subarray

i am trying to copy a second part of main array and need to store that in a new array.
For eg. if array1={“one”,“two”,“three”,“four”,“five”}
and need to copy the array(3) to end and store in a another array i.e array2.
Got to see this function - (array1.CopyTo(array2,3)) in .net, but not sure how to use it in uipath, can this be attained using invoke method.

yes, you can do it by invoke method as well as using Assign Activity

define array array3 = array1

Regards
Aditya

Thanks a lot for your response…i want to copy only second half of main array as i defined in the example above, could you please say the condition for it.
For eg. if array1={“one”,“two”,“three”,“four”,“five”}
and need to copy and store (“three”,“four”,“five”) in another array i.e array2 and i am not sure how to use invoke method for this.

Is it something that you want to copy first two elements(one and two) to array1 and the other three (three, four, five) to another array?

Is there any pattern?

Thanks,
Prankur

yes, i know the value, for eg. i know the value “Three”, want to split from “Three” to end of array and store it in a subarray, so tried using CopyTo function but couldnt do that and i am able to do that using Split method, but want to get the same result using CopyTo function.

HI @Raju23c,

Use below Logic

`array1={"1","2","3","4","5"}`
`array2=array1.ToList().GetRange(2,3).ToArray`

Output:
`array2 : {"3","4","5"}`

Regards,
Arivu

5 Likes

Thank you arivu96, it worked