//############################################################ // https://github.com/yuzhengyang // author:yuzhengyang //############################################################ using System.Collections.Generic; using System.Linq; namespace Y.Utils.DataUtils.Collections { public sealed class ListTool { /// /// 列表为空(null 或 count 等于 0) /// /// /// public static bool IsNullOrEmpty(List list) { if (list != null && list.Count() > 0) return false; return true; } /// /// 列表为空(null 或 count 等于 0) /// /// /// /// public static bool IsNullOrEmpty(List list) { if (list != null && list.Count() > 0) return false; return true; } /// /// 列表为空(null 或 count 等于 0) /// /// /// /// public static bool IsNullOrEmpty(IEnumerable list) { if (list != null && list.Count() > 0) return false; return true; } /// /// 列表至少有一个元素 /// /// /// /// public static bool HasElements(IEnumerable list) { return !IsNullOrEmpty(list); } } }