How can I concatenate the array content with its index value

Viewed 316

I want to concatenate the index value of array with its content and then save it in a new array.For example I have the array of distances arr[]={"1.3","1.5","4.6"}

I want to concatenate these distance values with their index values and store it in new array.. I want my new Array be like: new[]= {"1.3:0","1.5:1","4.6:2"} is it possible and if yes then please tell how.. i have searched the google and find this function

var s = String.Join("; ",data.Split(',')
              .Select((d, i) => d.Trim() + "= " + i.ToString())
              .ToArray());

but this function is for string and my array also don't have any comma for split function. what can be the solution for it ?

1 Answers
Related