I would like to use Linq instead of below function :
Friend Function IsCollectionInTable2(ByVal apps As DataTable, ByVal collectionId As String) As Boolean
For Each row As DataRow In apps.Rows
If row("CollectionId").ToString = collectionId Then Return True
Next
Return False
End Function
The best I can do is below:
Friend Function IsCollectionInTable(ByVal apps As DataTable, ByVal collectionId As String) As Boolean
Return (From row In apps.AsEnumerable()
Where (row.Field(Of String)("CollectionId") = collectionId)
Select row.Field(Of String)("CollectionId")).Count > 0
End Function
I would like to use Exists or Any in above function. Performance could be an issue,