List<string> 和string 互转

List<string>转字符串,用逗号隔开

List<string> list = new List<string>();
list.Add("a");
list.Add("b");
list.Add("c");
string s = string.Join(",", list.ToArray());

字符串转List<string>

string approvers="a,b,c";

var approverList = approvers.IndexOf(',') > 0 ? approvers.Split(',').ToList() : new List<string> { approvers };

 

posted @ 2020-09-18 17:34  夕颜4948  阅读(4535)  评论(0编辑  收藏  举报