score:18

Accepted answer

The function expects a List(Of Manufacturer) return type, not an IEnumerable(Of Manufacturer), so adding a .ToList() to the return value should fix it:

Return allMfrs.Except(unavailableMfrs).ToList()

score:3

Your function is declared as returning List(Of Manufacturer), but your Return statement is returning only an IEnumerable(Of Manufacturer). Change the return statement to:

Return allMfrs.Except(unavailableMfrs).ToList()

If you turn Option Strict On, I believe VB will catch this kind of error at compile time, instead of blowing up at runtime.

score:3

The problem is that Enumerable.Except returns IEnumerable<T>, but your return type is List(Of T).

Change your last line to:

Return allMfrs.Except(unavailableMfrs).ToList()

Related Articles