public class CheckUtil { /// <summary> /// 检测DataSet是否有数据 /// </summary> /// <param name="ds"></param> /// <returns></returns> public static bool CheckDataSet(DataSet ds) { bool res = false; if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { res = true; } return res; } /// <summary> /// 检测DataTable是否有数据 /// </summary> /// <param name="dt"></param> /// <returns></returns> public static bool CheckDataTable(DataTable dt) { bool res = false; if (dt != null && dt.Rows.Count > 0) { res = true; } return res; } public static bool CheckArray<T>(T[] array) { bool res = false; if (array != null && array.Length > 0) { res = true; } return res; } public static bool CheckList<T>(List<T> list) { bool res = false; if (list != null && list.Count > 0) { res = true; } return res; } }