C# 判断对象里所有属性的值是否存在空值
反射+泛型方法
public static bool ObjectIsNullOrEmpty<T>(T t) { foreach (var item in t.GetType().GetProperties()) { if (item.GetValue(t) == null) { return true; } if (item.GetValue(t).ToString() == "") { return true; } } return false; }