12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace SiwiFms.Helper
- {
- public static class ListStringExtensin
- {
- /// <summary>
- /// 转换为逗号隔开的字符串
- /// </summary>
- /// <param name="list"></param>
- /// <returns></returns>
- public static string ToArrayString(this List<string> list,string jg = ",")
- {
- if (list.Count == 0) return "";
- string returnstr = "";
- foreach (string str in list)
- {
- if (str == null||string.IsNullOrWhiteSpace(str)) continue;
- returnstr += (str + jg);
- }
- if (returnstr.Length == 0)
- {
- return returnstr;
- }
- else
- {
- return returnstr.Substring(0, returnstr.Length - jg.Length);
- }
- }
- public static object[] ToArrayObject(this List<string> list) {
- object[] objs = new object[] { };
- if (list.Count == 0) return objs;
- return list.ToArray();
- }
- }
- }
|