文件名从 Schedule/IStation.Algorithm/Helper/LongListHelper.cs 修改 |
| | |
| | | 锘縩amespace IStations |
| | | 锘縩amespace IStation |
| | | { |
| | | /// <summary> |
| | | /// 闀挎暣鍨嬪垪琛ㄨ緟鍔╃被 |
| | | /// 娴偣鏁板垪琛ㄨ緟鍔╃被 |
| | | /// </summary> |
| | | public class LongListHelper |
| | | public class DoubleListHelper |
| | | { |
| | | //鍒嗗壊瀛楃 |
| | | private const string _split = ","; |
| | |
| | | /// <summary> |
| | | /// 杞寲涓哄瓧绗︿覆 |
| | | /// </summary> |
| | | public static string ToString(IEnumerable<long> list) |
| | | public static string ToString(IEnumerable<double> list) |
| | | { |
| | | if (list == null || list.Count() < 1) |
| | | return string.Empty; |
| | |
| | | /// </summary> |
| | | /// <param name="str"></param> |
| | | /// <returns></returns> |
| | | public static List<long> ToList(string str) |
| | | public static List<double> ToList(string str) |
| | | { |
| | | if (string.IsNullOrEmpty(str)) |
| | | return new List<long>(); |
| | | return new List<double>(); |
| | | try |
| | | { |
| | | var list = str.Split(new string[] { _split }, StringSplitOptions.RemoveEmptyEntries); |
| | | if (list.Count() < 1) |
| | | return new List<long>(); |
| | | return list.Select(x => Convert.ToInt64(x)).ToList(); |
| | | return new List<double>(); |
| | | return list.Select(x => Convert.ToDouble(x)).ToList(); |
| | | } |
| | | catch |
| | | { |
| | | return new List<long>(); |
| | | return new List<double>(); |
| | | } |
| | | |
| | | } |