我相当肯定这可以重写为 Lambda 表达式,但每次尝试都惨遭失败。我知道,C# Lambda 读起来更干净,但我坚持使用 VB.NET。这是代码-有人可以指出我正确的方向吗?谢谢!
For Each e As EventToMonitor In Events
If e.TypeID = 1 Then
If ("," & e.Values).Contains("," & b.ChoiceID & ",") Then
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