How to search for member in list of members

Mikki
New Contributor III

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
1 REPLY 1

KarlT
Contributor II

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

 

Cheers