I want to convert Array into string as
string[] parts={"1","2","3","4"};
and output as
string str="%1%2%3%4%";
Use string.Join:
var str = string.Join("%", parts);
And add in the surrounding % marks:
str = string.format("%{0}%", str);
Using C#-6 string interpolation:
var str = $"%{string.Join("%", parts)}%";
string.Join will concatenate the strings in the array with a delimiter. Then you just have to add the "%" to the beginning and end.
string str = "%" + string.Join("%", parts) + "%";
string.Join("%", parts)then add in the start and end%.