小编Son*_*inc的帖子

使用Linq在值之间添加逗号

我的价值来自ComboBox:

2 | 722 | 742 | 762 | 77

我删除了不必要的字符如下:

foreach (var item in checkListBox)
{
    string[] list = item.Split(
        new string[] { "2|" },
        StringSplitOptions.RemoveEmptyEntries);
}
Run Code Online (Sandbox Code Playgroud)

我的列表值结果如下:

"72"
"74"
"76"
"77"
Run Code Online (Sandbox Code Playgroud)

我的问题是:

如何将以上所有上述值(以逗号分隔)放在一行(彼此相邻),如下所示:

72,74,76,77

c# linq add comma

1
推荐指数
1
解决办法
2417
查看次数

标签 统计

add ×1

c# ×1

comma ×1

linq ×1