P
Paul Prewett
Hi -
I have a situation where I'd like to use a lambda, but I'm not sure how.
Basically, I have a collection of objects and I want to set a property on
each object that meets a condition.
Right now, I have this:
IEnumerable<VariableCode> codes =
variable.VariableCodeList.Where(c => c.Type == "MyCondition");
foreach (VariableCode code in codes)
{
code.IsShown = true;
}//foreach
I'm thinking that I can replace the foreach bit with a single lambda
expression. Can anyone help me with that syntax?
Thanks.
I have a situation where I'd like to use a lambda, but I'm not sure how.
Basically, I have a collection of objects and I want to set a property on
each object that meets a condition.
Right now, I have this:
IEnumerable<VariableCode> codes =
variable.VariableCodeList.Where(c => c.Type == "MyCondition");
foreach (VariableCode code in codes)
{
code.IsShown = true;
}//foreach
I'm thinking that I can replace the foreach bit with a single lambda
expression. Can anyone help me with that syntax?
Thanks.