将列表转换成字符串

public static string ListToString(IList<string> stringList)
        {
            string result = "";
            if (stringList != null)
            {
                foreach (string value in stringList)
                {
                    result += "'" + value.Trim() + "',";
                }
            }
            if (!string.IsNullOrEmpty(result))
            {
                result = result.Remove(result.Length - 1, 1);
            }
            return result;
        }

 

posted @ 2020-03-26 15:55  风好累  阅读(1271)  评论(0编辑  收藏  举报