I have used for each loop and counter, I got code review comment like
"please use a lamba expression here, to isolate an occurrence, as opposed to iterating over all and then doing something in response to all found "
Please help how to use lamda expresion here. Thanks.
Private Function DiamondScoreCheckForOdType(ByVal currentPolicyLob As String, ByVal predominantState As String,
ByVal policyEffectiveDate As Date) As Boolean
Dim listOfLobForDiamondScoreRule As New HashSet(Of String) From {{getLineOfBusiness(Lob.LineOfBusiness.Auto)},
{getLineOfBusiness(AutoNonDealer)},
{getLineOfBusiness(Lob.LineOfBusiness.Garage)},
{getLineOfBusiness(EmploymentPracticesLiability_EP)},
{getLineOfBusiness(GeneralLiability)},
{getLineOfBusiness(InlandMarine)},
{getLineOfBusiness(PesticideHerbicide)},
{getLineOfBusiness([Property])},
{getLineOfBusiness(Umbrella)}}
Dim lobList As New List(Of String)
Dim eligibleLobCheckCounter As Integer = 0
lobList = currentPolicyLob.Split(ASTERISK).ToList()
For Each currentLob In lobList
listOfLobForDiamondScoreRule.Contains(currentLob)
If (listOfLobForDiamondScoreRule.Contains(currentLob)) Then
eligibleLobCheckCounter = eligibleLobCheckCounter + 1
End If
Next
If (eligibleLobCheckCounter > 0) Then
Dim isStateAndEffDateEligible As Boolean = (New LobCO.Shared.COShared).IsStateRuleApplicable(getLineOfBusiness(Lob.LineOfBusiness.Common),
predominantState,
policyEffectiveDate,
DiamondScoreRuleCheckForOdType)
Return isStateAndEffDateEligible
End If
Return False
End Function