Soul2的通用c#类库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
950 B

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 {
/// <summary>
/// 判断非空
/// </summary>
/// <param name="collection">集合对象</param>
/// <returns>是否非空</returns>
public static bool isNotEmpty(IEnumerable collection) {
return !isEmpty(collection);
}
/// <summary>
/// 判断为空
/// </summary>
/// <param name="collection">集合对象</param>
/// <returns>是否为空</returns>
public static bool isEmpty(IEnumerable collection) {
if (collection == null) {
return true;
}
foreach (var item in collection) {
return false;
}
return true;
}
}
}