My code has the following structure:
var a = ViewData["a"];
var b = ViewData["b"];
var c = ViewData["c"];
var d = ViewData["d"]:
foreach(var x in ObjetoE).where(x=> x.A == a && x.B == b && x.C == c && x.D == d){
// Faz alguma ação
}
In this case, my ObjetoE
would be something like this:
public class ObjetoE
{
public string A { get; set; }
public string B { get; set; }
public string C { get; set; }
public string D { get; set; }
}
What happens is that the values defined for the variables a
, b
, c
and d
are dynamically assigned, in this case, by ViewData
, being null .
In case what I would like to understand is if there is something that could catch all if a variable is null, such as *
of a query
. For it becomes impossible to work as conditionals validating if the variable is null and generating several foreach
on the basis of each condition.