VB.NET Lambda expression instead of iterator -
i rewritten lambda expression, every attempt fails miserably. know, c# lambda reads cleaner, i'm stuck vb.net. here code - point me in right direction? thanks!
for each e eventtomonitor in events if e.typeid = 1 if ("," & e.values).contains("," & b.choiceid & ",") notify(cachevalues, e, "event notification (button press)", "button pressed: " & b.text & " on screen: " & b.groupbox.text & environment.newline & "user: " & cachevalues.currentusername & environment.newline & _ "pressed at: " & date.now.toshortdatestring & " " & date.now.toshorttimestring) end if end if next
something should work if want convert whole thing lambda:
events.where(function(e) e.typeid = 1 andalso ("," & e.values).contains("," & b.choiceid & ",")) _ .tolist() _ .foreach(sub(e) notify(cachevalues, e, "event notification (button press)", "button pressed: " & b.text & " on screen: " & b.groupbox.text & environment.newline & _ "user: " & cachevalues.currentusername & environment.newline & _ "pressed at: " & date.now.toshortdatestring & " " & date.now.toshorttimestring))
honestly, though, prefer use them filter down results or build collection:
dim eventslist = events.where(function(e) e.typeid = 1 andalso ("," & e.values).contains("," & b.choiceid & ",")) each e eventtomonitor in eventslist notify(cachevalues, e, "event notification (button press)", "button pressed: " & b.text & " on screen: " & b.groupbox.text & environment.newline & "user: " & cachevalues.currentusername & environment.newline & _ "pressed at: " & date.now.toshortdatestring & " " & date.now.toshorttimestring) next
Comments
Post a Comment