I have following piece of code which removes the rows from the DataTable
based upon custom_id
as "Y" (i.e. remove the row if value for the key custom_id
is "Y" in the dictionary
). Now that I have very few records in list fldListWithUnlimitedDataEnabled
and relatively huge records in DataTable objDt
, is there a way to delete the specific rows (as done in objRow.Delete()
) from objDt
, so that I don't have to traverse entire DataTable
for few records?
Dim objRow As DataRow
Dim customFlds As Dictionary(Of String, String) = m_objCmnFncs.getCustomFlsdWithUnlimitedDataIndicator(strOrgId)
Dim fldListWithUnlimitedDataEnabled As List(Of String) = (From kv As KeyValuePair(Of String, String) In customFlds
Where kv.Value.Equals("Y")
Select kv.Key).ToList
If fldListWithUnlimitedDataEnabled.Count > 0 Then
For Each objRow In objDt.Rows
//The below condition effects the performance
If fldListWithUnlimitedDataEnabled.Contains(objRow("custom_id")) Then
objRow.Delete()
End If
Next
End If