using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Soul2.General.utils { public class CollectionsUtils { /// /// 判断非空 /// /// 集合对象 /// 是否非空 public static bool isNotEmpty(IEnumerable collection) { return !isEmpty(collection); } /// /// 判断为空 /// /// 集合对象 /// 是否为空 public static bool isEmpty(IEnumerable collection) { if (collection == null) { return true; } foreach (var item in collection) { return false; } return true; } } }