I have two IQueryable, wsSelectedApps
and allApps
. I need to loop through each app in allApps
and check if property app.AppID
exists in my other IQueryable.
My code so far is....
Dim wsSelectedApps = (From i In de.vw_AppsForWsList
Where i.WSID = WSID
Select i.ID, i.AppID)
Dim allApps = (From a In de.TblApps
Select a.AppID, a.AppName)
Dim appList As New List(Of DeploymentModel)
For Each app In allApps
'Loop through allApps and build up appList
If xxxxxxxxxx Then
'this app exists in wsSelectedApps
appList.Add(New DeploymentModel With {
.AppID = app.AppID,
.AppName = app.AppName,
.ID = wsSelectedApps.ID,
.Selected = True})
Else
'this app does not exist in wsSelectedApps
appList.Add(New DeploymentModel With {
.AppID = app.AppID,
.AppName = app.AppName,
.ID = 0,
.Selected = False})
End If
Next
The IF
statement originally had
If wsSelectedApps.Contaings(app.AppID) Then...
This was fine when wsSelectedApps
was just a list of AppIDs
but it now contains two properties. How do I check if the app.AppID
exists in wsSelectedApps
?