I have BackgroundWorkerCollection which is a list of a specific class. When i try to loop into the list and filter and select a single i'm getting the mentioned error.
//Code
Dim bw = From BackgroundWorkerLinq In BackgroundWorkerCollection Where BackgroundWorkerLinq.Id = sItemNo Select BackgroundWorkerLinq.Backgroundworker
Is it possible to convert the bw
to Backgroundworker
, the class created in the application has two properties Id(int
) and Backgroundworker(Backgroundworker
). So i have to convert back to the same to check if that is busy or not.
Where i'm wrong and how to achieve that?
bw
will be a sequence of BackgroundWorker
items - so you can't cast from that sequence to a single item. There are a number of methods which will give you a single item, e.g.
First
FirstOrDefault
Single
SingleOrDefault
Last
LastOrDefault
You should work out whether you should use one of those, or actually iterate over all the results of the query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With