更新时间:2023-01-14 12:50:04
VAR的结果=的string.join(,,ARR);
这使用以下过载的string.join
:
公共静态字符串加入< T>(字符串分隔符,IEnumerable的< T>值);
It's a simple question, I am newbie in C#, how can I do this :
convert an array of integers to a comma-separated string
I have
int[] arr = new int[5] {1,2,3,4,5};
I want to convert it to one string
string => "1,2,3,4,5"
var result = string.Join(",", arr);
This uses the following overload of string.Join
:
public static string Join<T>(string separator, IEnumerable<T> values);