I am having trouble with a LINQ query -
Dim otherRecords As List(Of Objects) = listOf.Where(Function(x) x.ID_NUM = newID _
And (x.Codes.Contains(ddlPrimaryCode.SelectedItem.Text.Trim) And Not x.Codes = Nothing)).ToList()
Error An exception of type 'System.NullReferenceException' occurred in CI.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object.
The problem is the listOf contains the value "Nothing" for the x.Codes.Contains.
Before I had
Dim otherRecords As List(Of Objects) = listOf.Where(Function(x) x.ID_NUM = newID _
And (x.Codes.Contains(ddlPrimaryCode.SelectedItem.Text.Trim)).ToList()
And it was crapping out.
I need to be able to return only records with matching ID_NUM and Codes.