Forum Discussion

Mikki's avatar
Mikki
New Contributor III
3 months ago

How to search for member in list of members

Hi,

I have a requirement where I need to compare a member in list of members (listOfmem) and see if the member exists in list. How to best handle this as it seems like I can't use "Contains" function?

 Dim listOfmem As list(Of memberinfo) = BRApi.Finance.Members.GetMembersUsingFilter(si, U2DimPk, U2DimMem, True)
 
Thank you in advance,
Mikki
  • You can try this this approach where the listofmem is defined per your question:

    If listOfmem.Any(Function(x) x.Member.Name = "MemberName") Then
    	brapi.ErrorLog.LogMessage(si,"found")
    End If

     

  • KarlT's avatar
    KarlT
    Contributor III

    You can try this this approach where the listofmem is defined per your question:

    If listOfmem.Any(Function(x) x.Member.Name = "MemberName") Then
    	brapi.ErrorLog.LogMessage(si,"found")
    End If