object properties check if IsAnyNullOrEmpty
List obrCol >>> nomes das propriedades a verificar
public bool IsAnyNullOrEmpty(object obj, List<string> obrCol)
{
foreach (PropertyInfo pi in obj.GetType().GetProperties())
{
foreach (string col in obrCol)
{
if (pi.Name == col)
{
string value = pi.GetValue(obj)?.ToString() ?? "";
if (string.IsNullOrEmpty(value))
{
return true;
}
}
}
}
return false;
}