namespace IStation { /// /// 整数列表辅助类 /// public class IntListHelper { //分割字符 private const string _split = ","; /// /// 转化为字符串 /// public static string ToString(IEnumerable list) { if (list == null || list.Count() < 1) return string.Empty; return string.Join(_split, list); } /// /// 转化为列表 /// /// /// public static List ToList(string str) { if (string.IsNullOrEmpty(str)) return new List(); try { var list = str.Split(new string[] { _split }, StringSplitOptions.RemoveEmptyEntries); if (list.Count() < 1) return new List(); return list.Select(x => Convert.ToInt32(x)).ToList(); } catch { return new List(); } } } }