Given the following query:
Select * from myTable where stringField in ('A','B','C')
I’ll be pulling items from a db, and haven’t yet decided if I will store them in a list, or an array, or some other collection object, but ideally want something built in (no custom class), and without manual iteration.
Focus is on performance and code maintainability.
What would be the most efficient way to do this in .net?
Thanks in advance
The most convenient way would be
Enumerable.Contains(.NET 3.5 upwards). It should also be performing well, although I have not benchmarked.Example: