usr021986 usr021986 - 1 month ago 9
C# Question

Insert a element in String array

I have string containing n elements.

I want to insert a automatically incremented number to the first position.

E.g
Data

66,45,34,23,39,83
64,46,332,73,39,33
54,76,32,23,96,42


I am spliting to string to array with split char ','

I want resultant array with a incremented number a first position



1,66,45,34,23,39,83
2,64,46,332,73,39,33
3,54,76,32,23,96,42


Please suggest how can I do it.

Thanks

Answer

appended the incremented number using for lopp to the string

1,66,45,34,23,39,83
2,64,46,332,73,39,33
3,54,76,32,23,96,42