Lambda

Lamda Where


If cPadMain.PadHistoryList.Where(Function(h) h.IsNew = True).Count <> 0 Then
Dim cPadHistoryData As New PadHistoryData(Me.ConnectionStringSettings)
For Each ph As PadHistory In cPadMain.PadHistoryList.Where(Function(h) h.IsNew = True)
cPadHistoryData.Insert(ph)
Next
End If

Lamda Max

Dim dList As IList(Of Decision) = CType(DecisionBindingSource.DataSource, IList(Of Decision))
dNew.ID = dList.Max(Function(d) d.ID) + 1

Lamda check for repeats

Public Function IsSupplierPriorityOK() As Boolean
 
    'Lambda Check for repeats
    For Each cs1 As Costing.ComponentSupplier In Me.ComponentSupplierList.OrderBy(Function(h) h.Priority)
        Dim p1 As Integer = cs1.Priority
        If Me.ComponentSupplierList.Where(Function(h) h.Priority = p1).Count <> 1 Then
            Return False
        End If
    Next
    Return True
 
End Function

Leave a comment