我怎样才能简化这样的陈述:
var someList = new List<someType>();
if (String.IsNullOrEmpty(groupId))
{
someList = CTX.Values.Include(c => c.Customer).ToList();
}
else
{
someList = CTX.Values.Include(c => c.Customer).Where(c => c.GroupId== groupId).ToList();
}
区别仅在.Where(c => c.GroupId== groupId)
. 是否可以String.IsNullOrEmpty(groupId)
在查询语句中包含条件?