I would like to ask something please.
Supposing the following expression Dim ExistsPosValue1 As Func(Of GatesPositions, Boolean) = Function(p) p.pos = 3 how can I get with only a statement the returning value (true - false). I can do it with the following but I would like something directly than that? Any explanations please? Thank you so much in advanced. Any help will be much appreciated.
Supposing the following expression Dim ExistsPosValue1 As Func(Of GatesPositions, Boolean) = Function(p) p.pos = 3 how can I get with only a statement the returning value (true - false). I can do it with the following but I would like something directly than that? Any explanations please? Thank you so much in advanced. Any help will be much appreciated.
Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Chck()
End Sub
Public Sub CheckFuncOf(ByVal ExistsPosValue1 As Func(Of GatesPositions, Boolean), ByVal GtPos As GatesPositions?)
Dim Flg As Boolean
If ExistsPosValue1.Invoke(GtPos) Then
Flg = True
End If
End Sub
Public Sub Chck()
Dim ExistsPosValue1 As Func(Of GatesPositions, Boolean) = Function(p) p.pos = 3
Dim GtPos As GatesPositions? = PcCheckerGates.First(Function(x) x.pos = 3)
CheckFuncOf(ExistsPosValue1, GtPos)
End Sub