onmyway365 .

onmyway365 .

  • NA
  • 39
  • 4.6k

2 Simple Lambda Expression in 1?

Jan 22 2016 2:07 AM
Hi all,
 
I have a fairly simple question:
 
How can I combine 2 lambda expression in one (is it possible)?
 
I want to update 2 fields for the same record: 
 
deltaList.ForEach(u => u.Processing_Result = 0); 
deltaList.ForEach(u => u.Processing_Result_Text = "UNIQUE");
 
PLEASE NOTE: I have tried to combine these 2 with &&, but get an error as one is int and the other string.   
 
Also, how can I combine these 2 expressions:
 
var data = stageContext.ProjectMasters.Where(u => u.Processing_Result == 0); 
AND  (u => u.Processing_Result_Text = "UNIQUE")
 
PLEASE NOTE: It seems I can combine these 2 with && (like below) - is this correct?
 
var data = stageContext.ProjectMasters.Where(u => u.Processing_Result == 0 && u.Processing_Result_Text == "UNIQUE"); 
 
Thank you :) 

Answers (2)