//************************************************************************ // https://github.com/yuzhengyang // author: yuzhengyang // date: 2017.3.29 - 2017.9.12 // desc: 元素列表工具类 // Copyright (c) yuzhengyang. All rights reserved. //************************************************************************ using System; using System.Collections.Generic; using System.Linq; using Y.Utils.YUtils; namespace Y.Utils.DataUtils.Collections { /// /// 元素列表工具类 /// public sealed class ListTool { /// /// 列表为空(null 或 count 等于 0) /// /// 元素类型 /// 元素列表 /// [Obsolete("Please Use HasElements(list)", false)] public static bool IsNullOrEmpty(IEnumerable list) { YUtilsAuth.Check(); if (list != null && list.Count() > 0) return false; return true; } /// /// 列表至少有一个元素 /// /// 元素类型 /// 元素列表 /// public static bool HasElements(IEnumerable list) { return !IsNullOrEmpty(list); } } }